Php – How to remove EXIF tags while preserving the ICC color profile

color-managementcolor-profileimagemagickimagickPHP

I am programmatically generating several sizes of thumbnails for images.

I need to preserve the color space of an image while removing all (other) EXIF information.

I am using imagick on PHP 5.3, but information on how to do this with any imagemagick API would be helpful.

I'm trying to prune the file size of my image thumbnails as much as possible, but the color space is necessary information or the client doesn't render the colors accurately enough.

Best Answer

To achieve this I used MagickStripImage() to remove all the extraneous data, then ran -convert [inputJPG] -profile [profile] [outputJPG] to add the sRGB profile again.

This worked for my purposes (as I'd already done profile conversion beforehand, so all my profiles are sRGB). I did try Tom's suggestion of using ExifTool (which is fantastic) but couldn't get it to strip out EXIF+XMP+IPTC and leave the profile intact.

Related Topic