8

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

  • 2
    This seems to work: exiftool -all= image.jpg -tagsfromfile @ -colorspace -interopindex -icc_profile (As per answer from duplicate question.) – Jens Nov 2 '14 at 13:01
  • 3
    You can answer your own question as an answer instead of a comment, and that answer will be up or downvoted. ;-) – TFuto Nov 2 '14 at 15:00
  • @StarGeek Post that as an answer, please. – mattdm Sep 29 '15 at 13:40
  • 1
    Could you guys post ExifTool comments as answers? Preferably with a little bit of elaboration on the specifics? Thanks! – jrista Sep 29 '15 at 16:20
8

Since there was a request for posting my comment as an answer, here it is, updated version.

ExifTool -All= --ColorSpaceTags DIRorFILES
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). The double dash option indicate it is to be excluded from the -All= tag deletion operation. Edit: Updated with a better command. Removes all data, then copies the color info back into the file with -TagsFromFile @.

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 or tiff based file such as Nikon or Canon raw images (NEF or CR2), 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).

  • Doesn't work with exiftool 10.80 for JPEG files — color profile also gets removed. – Sarge Borsch May 3 '18 at 17:17
  • 1
    @SargeBorsch, updated with better command. – StarGeek May 4 '18 at 14:41
0

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.

  • 5
    I remove at least all the XMP data because that contributes nothing to the image, and is almost a privacy concern to me. – Jens Nov 3 '14 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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