Remove metadata keeping some such as Keywords and RegionName

Started by brunos, January 02, 2024, 10:56:00 AM

Previous topic - Next topic

brunos

Hi all,

Searching all around, I've collected examples and assembled the following syntax, aimed to filter out the most of the metadata, keeping the listed ones.

exiftool -all= -tagsfromfile @ -ImageWidth -ImageHeight -DateTimeOriginal -ExposureProgram -ISO -CameraISO -AutoISO -ShutterSpeedValue -FocalLength -ApertureValue -artist -Keywords  -RegionAppliedToDimensionsH -RegionAppliedToDimensionsUnit -RegionAppliedToDimensionsW -RegionName -RegionType -RegionAreaH -RegionAreaUnit -RegionAreaW -RegionAreaX -RegionAreaY testimage1.jpg
It seems to work in the tests I've made. But I'm not sure if it's a good way to handle such a clean-up. Does this code looks safe? Is there a better way to handle it?

Thanks in advance
Bruno

Phil Harvey

I would recommend this to preserve the color space tags (as per FAQ 32).

Also you may want to add Subject to the list of tags because it is the modern XMP version of the old IPTC Keywords tag.  And it would be better to copy the region as a structure instead of as flattened tags (to preserve the correlations if there are multiple regions).

exiftool -all= --icc_profile:all -tagsfromfile @ -colorspacetags -ImageWidth -ImageHeight -DateTimeOriginal -ExposureProgram -ISO -CameraISO -AutoISO -ShutterSpeedValue -FocalLength -ApertureValue -artist -Keywords -Subject -RegionInfo testimage1.jpg

There may be some other tags you should add, depending on what tags are important to you.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

brunos

Thank you Phil!