using ImageMagick; namespace Image.Core { /// /// ExifRemoverAndCompressor removes exif metadata from an image. /// public class ExifRemoverAndCompressor : IMetadataRemover { private readonly ICompressor _compressor; private readonly IMagickImage _magickImage; /// /// Constructs an instance of ExifRemoverAndCompressor. /// /// MagicImage instance. /// Compressor instance. public ExifRemoverAndCompressor(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); } /// public string GetImagePath() { return _magickImage.FileName; } } }