How to preserve certain custom tags while overwriting other tags

Started by claw99, May 26, 2021, 08:19:21 PM

Previous topic - Next topic

claw99

I feel like this question must have been asked before, but I do not see it. I am preserving a whole bunch of tags and want all others to be overwritten.  I'm extracting any custome tags and then if they have certain keywords in the tag I don't want to overwrite them.  The command I'm using:

exiftool -overwrite_original -all= --icc_profile:all -tagsFromFile @ -artist -copyright ........ -<any custom tags I find that have key word>

so if there was a custom tags in the image called "MyCopyright" and "MyRights" my command would be:

exiftool -overwrite_original -all= --icc_profile:all -tagsFromFile @ -artist -copyright -mycopyright -myrights

But this does not preserve the custom tags.  They get overwritten.  I have seen other posts on here about writing custom tags and I'm wondering if I have to follow that or since the custom tags are already in the image, I thought there might be a simpler way to not overwrite a custome tag? For each image I run into I the custom tags could be different, so it is not a situation where I know beforehand the custom tags I will be dealing with.
I'm using ExifTool 12.24

StarGeek

Your command removes all the tags and then copies them back into the file.  Exiftool will need definitions in order to put them back in the file.

You're going to have to be more specific which tags you want to remove when there are custom tags you want to keep and don't have a config file definition for the custom tags.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

claw99

Thank you!  Ok, so to avoid having to have a config file, I need to not remove the tag in the first place.  So in my command I can't use "-all="  but instead be more specific?

StarGeek

Unfortunately, that is the case.  There are more details under the --TAG option and note 4 under the -TAG[+-^]=[VALUE] option.

Any Group 0 or Group 1 will delete the group as a block when combined with All (see GetAllGroups for group lists).  You can try using wildcards to delete tags, i.e. -GPS*= will delete all tags that start with GPS, but won't delete the block.  Also, you can create a shortcut in a config file to to hold tags you're most likely to delete.  Also check the Shortcut tags page for possibly useful shortcuts that already exist.  CommonIFD0 is one such example, which can be used the clear common EXIF tags from a TIFF file, since you can't use -EXIF:All= on a TIFF file without removing the image data (FAQ #7).
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).