Image-ExifTool - Deleting all but a few tags

Posted on Thu Mar 27 02:09:10 2008 by rogerhoward
Deleting all but a few tags
I've got a script which allows a user to delete all metadata from an image except the values of tags stored in a whitelist. I thought the exiftool invocation would be something as simple as: exiftool -all= --Creator --Copyright image.jpg Then I realized the docs make it clear that won't work - "Note that this will not exclude individual tags from a group delete. Instead, the tags must be recovered using the -TagsFromFile option". So I figured to use the -TagsFromFile option instead, something like: exiftool -all= -TagsFromFile image.jpg -Copyright -Creator image.jpg But in that case I get the following output: Warning: Error parsing XMP - image.jpg 1 image files updated And the resulting JPEG still appears to have all of it's metadata. In the end, I resorted to an ugly solution that involves three invocations of exiftool: 1. Use exiftool to read the tags I'm interested in keeping 2. Use exiftool -all= to remove all metadata 3. Use exiftool to add the tags I preserved in step 3 back to the file Is there a single step way of wiping all metadata except specific tags? I can live with some limitations - for instance, if some tags cannot be preserved individually. PS, love love love Exiftool. This is the first stumper I've had in several years. Best, R
Direct Responses: 7480 | Write a response