1

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.

2
  • Did you find a way to remove the EXIF data with ImageMagick? I've found command-line examples, but none that do it inside of the PHP extension.
    – Sonny
    Mar 30, 2010 at 17:32
  • Just in case anybody is looking for this, stackoverflow.com/questions/3614925/…
    – Bill H
    Sep 1, 2010 at 4:59

2 Answers 2

1

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.

0

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.

1
  • Thanks for the tip, I installed that app. I actually don't think the color profile is stored in the EXIF data, but rather as part of the image format. That said, the way that imagemagick interacts with EXIF data and color profiles are similar.
    – Kyle Wiens
    Jan 25, 2010 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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