ExifTool: Remove all meta data except specific tags

2

1

I am trying to remove all meta data from JPEG files except common photo tags as listed with exiftool -common (camera model, shutter speed, aperture, ISO, etc.) lens model, color space and embedded ICC profile.

Using the answer from question exiftool: delete exif data but preserve some specific tags, the following commands are produced. The problem is that both of them result in removing shutter speed, aperture and the embedded ICC profile as can be verified using exiftool with the respective flags.

exiftool -all= -tagsFromFile @ -common -LensModel -ColorSpace -icc_profile:all original.JPG

exiftool -all= -tagsFromFile @ -common -aperture -ShutterSpeed -LensModel -ColorSpace -icc_profile:all original.JPG

They both produce warning:

Warning: Sorry, filesize is not writable

Are the commands malformed or is this an ExifTool bug? This behaviour is confirmed on ExifTool version 10.40.

Kyselejsyreček

Posted 2018-02-17T18:14:05.450

Reputation: 224

1

Possible duplicate of exiftool: delete exif data but preserve some specific tags

– flolilo – 2018-02-17T18:23:41.873

Using the answer from the referenced question, one gets the unexpected result pointed out in my question. – Kyselejsyreček – 2018-02-17T18:26:33.657

I shifted my answer to that question - I tested mine and it works.

– flolilo – 2018-02-17T18:38:08.740

Also note that v10.40 is from january 2017 - v10.79 was released recently. The latest production release is v10.55 - in June 2017. – flolilo – 2018-02-17T18:45:24.667

Thank you, this answers my question. Please also note that the flags containing the < sign will not work on Linux upon encapsulation with apostrophes. – Kyselejsyreček – 2018-02-17T18:50:10.063

Glad I could help :-) You mean that you have to escape <? May I ask how you do that? Then I can add it into my answer (you could edit it as well). – flolilo – 2018-02-17T19:02:19.950

Yes, that is exactly what I have meant. Writing '<' suffices but one can wrap the whole parameter, e.g. 'common<common'. However, I cannot seem to make the command work as expected. The resulting images lack information about shutter speed and aperture and even Camera Model Name reads "Off, Did not fire". Adding '-aperture<aperture' -ShutterSpeed<ShutterSpeed' after `'-common<common' has no effect. – Kyselejsyreček – 2018-02-17T19:35:53.187

1would you mind switching over to my answer? I now edited it so -common is not needed any more. – flolilo – 2018-02-17T20:13:58.533

Answers

2

The Common shortcut tag is more of a data collection tag and it really isn't meant for copying info from one file to another (see Shortcut tags for list of tags is contains). Many of that tags covered by that shortcut are either filesystem tags (FileSize), MakerNotes tags (Quality), or Composite tags (Aperture, ShutterSpeed). In the case of FileSize, you obviously can't arbitrarily change the size of the destination file, thus the filesize is not writable error.

In the case of Makernotes tags, they cannot be copied or created individually. It has to be copied as a block with -MakerNotes. You may not have been trying to copy the Quality tag, but this point becomes relevant when it comes to Composite tags.

Composite tags aren't tags that are in the file. They are derived from multiple other tags. Aperture and ShutterSpeed are two examples. You can't copy them to another file because individually, they don't exist. You have to copy the tags that they're based upon. Aperture is based upon either FNumber or ApertureValue, depending upon which is actually in the file. ShutterSpeed is based upon ExposureTime, ShutterSpeedValue, and/or BulbDuration. To correctly "copy" Aperture and ShutterSpeed, you have to copy the above tags that they're based upon. And some of those tags may be only in the MakerNotes, so you would have to copy the entire Makernotes

ICC_Profile is considered an "unsafe" tag and will not be copied unless it is explicitly listed. You probably have to copy it as a block with -ICC_Profile if -ICC_Profile:all doesn't work as some of the individual tags in the ICC_Profile are not writable.

tl;dr: There's nothing wrong with the exiftool command, it just doesn't do what you think it does.

StarGeek

Posted 2018-02-17T18:14:05.450

Reputation: 782

liked the tl;dr: and Totally agree with it. – C0deDaedalus – 2018-02-18T09:58:18.723