10
\$\begingroup\$

For a while now I have used exiftool to strip away unnecessary metadata from jpg files (and to add copyright information) before uploading them:

exiftool -all= image.jpg

However, today I noticed that this can damage the image when my editing software embeds additional color information into the metadata (see for example this article).

Distorted and original image.

Left is the damaged image, and to the right the original right out of the raw developer.

My question now is, which metatags are safe to strip and which are essential to keep? For example, based on the image ICC tags (i.e. -icc_profile:all) shouldn't be stripped if they exist? (Possible duplicate of this question.)

\$\endgroup\$
0

2 Answers 2

10
\$\begingroup\$
exiftool -all= -TagsFromFile @ -ColorSpaceTags DIRorFILES

This command will remove nearly all metadata but retain ExifIFD:ColorSpace, ExifIFD:Gamma, InteropIFD:InteropIndex, and ICC_Profile tags. ColorSpaceTags is an ExifTool shortcut for “standard tags which carry color space information” (added in ver 9.51).

There are some caveats. -All= will not delete Adobe APP14 block in jpegs, as this may affect the colors of the image. No personal info is held in this block, so there is normally no need to delete it. It will also not delete Exif tags in a tiff, as the image data itself is contained in the Exif block. -CommonIFD0= can be added to the command to clear out most common Exif tags in these images. See ExifTool Shortcut tags for full list of tags contained in the CommonIFD0 shortcut.

Also take note that you do not want to run -All= on a RAW file type such as NEF or CR2, as it will break the file and make it impossible to diplay. This is because some of the EXIF and MakerNotes data is needed to properly render the image. See exifool's FAQ #8 and FAQ #20.

\$\endgroup\$
3
  • \$\begingroup\$ It may be desirable to additionally pass -Orientation in order to preserve any rotation information. \$\endgroup\$ Commented Jun 6, 2021 at 13:59
  • \$\begingroup\$ This is the correct answer however exiftool still emits "Warning: ICC_Profile deleted." This is likely because what this command does is basically remove all metadata, then adds back the colour space information. This can be confirmed working by running exiftool -ColorSpaceTags photo.jpg to verify that the colour space info is still present. \$\endgroup\$
    – Kevin Cox
    Commented Jan 8, 2022 at 16:03
  • \$\begingroup\$ @AndrewMarshall I specifically strip the orientation tag to prevent auto-rotation from messing up my images. My image editor does not change the tag when I rotate an image during editing, so when I upload it to a site that also does rotation it gets double rotated. \$\endgroup\$ Commented Jan 12, 2022 at 19:55
1
\$\begingroup\$

I don't recommend you to remove metadata from your original images. It make sense to do this for images that you want to share or publish, during the export stage for the next reasons:

  • You might take a look at the metadata of some of your beautiful images later, to see their exposure, GPS info, etc...
  • Like Paul said, images with the sRGB profile will be 99.9% correctly viewed on any device or web-browser while images with another profiles can be displayed unpredictable for other people.
  • Your images can be optimized for better and faster viewing when exporting
  • You can do a lot of other post-processing things with your images during the export like sharpening, applying watermarks, etc...

So my suggestion is: don't remove metadata from your images that is value for you. And instead use a photo management software to export your images to a right format, applies your profile, strip metadata, assign your copyrights and contact info and add your watermarks.

\$\endgroup\$
1
  • 6
    \$\begingroup\$ I remove at least all the XMP data because that contributes nothing to the image, and is almost a privacy concern to me. \$\endgroup\$
    – Jens
    Commented Nov 3, 2014 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.