Recommended "safe" option to strip metatdata?

Started by TomD, April 08, 2024, 02:22:52 AM

Previous topic - Next topic

TomD

Hello, I was comparing the recommended "safe" option in the FAQ to strip metatdata:

exiftool -all= --icc_profile:all -tagsfromfile @ -colorspacetags file.jpg
to the comparable option in imagemagick to strip all metadata but ICC profile

convert -auto-orient -thumbnail 100% input.jpg output.jpg
I notieced that exiftool copies back color space tags (good), but it ends up with different x and y resolution tags than in the original.  Imagemagick preserves the original x and y resolution tags.  Is this a bug in exiftool?

Quote from: Original File and output.jpg after Imagemagick stripX Resolution                    : 300
Y Resolution                    : 300
Resolution Unit                 : inches

Quote from: After exiftool stripX Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches

There are no other X and Y resolution tags in the metadata, so it's not caused by multiple tags with different values.

Also, I'm curious why it's considered "safe" to strip the Orientation tag?  I would think it should be preserved, especially now that modern browsers respect the tag, there's no need to manually rotate and strip the flag for the web.  Perhaps the FAQ should be updated to include a "safe" option that copies back Orientaion, e.g.

exiftool -all= --icc_profile:all -tagsfromfile @ -colorspacetags -Orientation file.jpg
Or even better to only copy it back if > 1?

Also, it there a way to specify an input file and output file when stripping metadata from images?  It seems exiftool makes a copy of the original and writes back to the original file name which is somewhat non-standard.  Would be nice to have it as an option.

Phil Harvey

QuoteI notieced that exiftool copies back color space tags

It doesn't actually.  When EXIF is created, ExifTool adds some mandatory tags, including the resolution tags, with default values.  You can preserve these if you want by adding them after the -tagsfromfile argument.

QuoteAlso, I'm curious why it's considered "safe" to strip the Orientation tag?

That's a good point, you should probably copy this one back too.

QuoteIt seems exiftool makes a copy of the original and writes back to the original file name which is somewhat non-standard.  Would be nice to have it as an option.

Take a look at the -o option.

- 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 ($).

StarGeek

Quote from: TomD on April 08, 2024, 02:22:52 AMI notieced that exiftool copies back color space tags (good), but it ends up with different x and y resolution tags than in the original.  Imagemagick preserves the original x and y resolution tags.  Is this a bug in exiftool?

No.  Exiftool will not copy tags that are not requested.  If you need the resolution tags copied, then you need to include them. You should also use the command in FAQ #3 as the resolution tags are duplicated in several groups, so you would need to check to make sure you copied them all

QuoteIt seems exiftool makes a copy of the original and writes back to the original file name which is somewhat non-standard.

One of the most common questions on these forums is how not to create the backup files (see the -overwrite_original option).
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

TomD

Ah, got it.  The X and Y resolution are just default values if nothing is copied back, not necessarily tags copied back with the colorspace option.  That seems a little odd, I would think if it has to add default values it would retain those from the original image, but no biggie, thanks for the clarification, and the tip on the -o option.