How can I strip tags from a JPEG without removing the color profile?
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).
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.)
Since there was a request for posting my comment as an answer, here it is, updated version.
ExifTool -All= --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.
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).
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.