using ImageMagick; namespace Image { /// /// MetadataRemover removes metadata from an image. The exif profile. /// public class MetadataRemover : IMetadataRemover { private readonly ICompressor _compressor; private readonly IMagickImage _magickImage; /// /// Constructs an instance of MetadataRemover. /// /// MagicImage instance. /// Compressor instance. public MetadataRemover(IMagickImage magickImage, ICompressor compressor) { _magickImage = magickImage; _compressor = compressor; } /// /// Cleans the images and compresses it. /// /// The file path to save the clean image. public void CleanImage(string newFilePath) { _magickImage.RemoveProfile("exif"); _magickImage.Write(newFilePath); _compressor.Compress(newFilePath); } } }