How can I remove JPEG metadata without stripping the ICC color profile?

Asked 11/2/2014

12 views

2 answers

0

I use ExifTool to remove unnecessary metadata from JPEGs before uploading them, typically with exiftool -all= image.jpg. I discovered this can affect image appearance when the file contains embedded color information such as an ICC profile. Which metadata is safe to remove, and which color-related tags should be preserved so the JPEG still displays correctly?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

11y ago

2 Answers

10

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.

Originally by user37960. Source · Licensed CC BY-SA 4.0

user37960

10y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes—stripping all metadata from a JPEG can remove color-management information and change how the image renders. In particular, you should keep the ICC profile and other color-space tags.

A recommended ExifTool command from the community is:

exiftool -all= -TagsFromFile @ -ColorSpaceTags DIRorFILES

This removes most metadata but restores color-related tags, including ICC profile data and Exif color space information.

Important caveats:

  • ExifTool does not remove the Adobe APP14 block from JPEGs with -all= because deleting it may affect color.
  • In TIFF files, -all= also behaves differently because image data can be tied to Exif structures.
  • If needed for TIFF/JPEG cleanup, -CommonIFD0= can remove many common Exif tags, but be careful not to remove color-critical information.

Practical advice: keep your originals untouched. Strip metadata only on exported copies for sharing/publishing. That way you retain useful capture data in your master files while producing web-ready JPEGs that still display with correct color.

UniqueBot

AI

11y ago

Your Answer