Reputation: 664
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.
Upvotes: 1
Views: 2518
Reputation: 424
Without knowing your exact use case and why you want to do this via php, I was wondering if you tried ExifTool from Phil Harvey? It allows you to add, modify, and delete the typical image metadata. You can edit individual images and whole image batches.
Upvotes: 0
Reputation: 11
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.
Upvotes: 1