How to clean exif data in tiff image

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 :

import aspose.pycore as aspycore
from aspose.imaging import Image
from aspose.imaging.fileformats.tiff import TiffImage
import os
if 'TEMPLATE_DIR' in os.environ:
templates_folder = os.environ['TEMPLATE_DIR']
else:
templates_folder = r"C:\Users\USER\Downloads\templates"
delete_output = 'SAVE_OUTPUT' not in os.environ
def clean_exif_data(frame_options):
frame_options.artist = None
frame_options.copyright = None
frame_options.date_time = None
frame_options.document_name = None
frame_options.image_description = None
frame_options.page_name = None
frame_options.ink_names = None
frame_options.scanner_manufacturer = None
frame_options.scanner_model = None
frame_options.software_type = None
frame_options.target_printer = None
frame_options.xp_title = None
frame_options.xp_comment = None
frame_options.xp_author = None
frame_options.xp_keywords = None
frame_options.xp_subject = None
data_dir = templates_folder
with aspycore.as_of(Image.load(os.path.join(data_dir, "template.tiff")), TiffImage) as image:
image.xmp_data = None
for frame in image.frames:
clean_exif_data(frame.frame_options)
image.save(os.path.join(data_dir, "result.tiff"))
if delete_output:
os.remove(os.path.join(data_dir, "result.tiff"))