How to clean exif data in tiff image
Contents
[
Hide
]
How to clean exif data in tiff image
Issue : How to clean exif data in tiff image.
Tips : To clean exif data in tiff image, it is needed to clean needed tags in frames.
Example :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Aspose.Imaging; | |
using Aspose.Imaging.Brushes; | |
using Aspose.Imaging.FileFormats.Png; | |
using Aspose.Imaging.FileFormats.Svg; | |
using Aspose.Imaging.FileFormats.Tiff; | |
using Aspose.Imaging.FileFormats.Tiff.Enums; | |
using Aspose.Imaging.ImageOptions; | |
using Aspose.Imaging.Sources; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
string templatesFolder = @"c:\Users\USER\Downloads\templates\"; | |
string dataDir = templatesFolder; | |
using (TiffImage image = (TiffImage)Image.Load(dataDir + "template.tiff")) | |
{ | |
image.XmpData = null; | |
foreach (TiffFrame frame in image.Frames) | |
{ | |
CleanExifData(frame.FrameOptions); | |
} | |
image.Save(dataDir + "result.tiff"); | |
} | |
File.Delete(dataDir + "result.tiff"); | |
void CleanExifData(TiffOptions frameOptions) | |
{ | |
frameOptions.Artist = null; | |
frameOptions.Copyright = null; | |
frameOptions.DateTime = null; | |
frameOptions.DocumentName = null; | |
frameOptions.ImageDescription = null; | |
frameOptions.PageName = null; | |
frameOptions.InkNames = null; | |
frameOptions.ScannerManufacturer = null; | |
frameOptions.ScannerModel = null; | |
frameOptions.SoftwareType = null; | |
frameOptions.TargetPrinter = null; | |
frameOptions.XPTitle = null; | |
frameOptions.XPComment = null; | |
frameOptions.XPAuthor = null; | |
frameOptions.XPKeywords = null; | |
frameOptions.XPSubject = null; | |
} |