ralphch has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm looking for a way to optimize my thumbnails while still maintaining the IPTC information, but not other profiles (i.e. EXIF, etc). If you see,

http://www.definitedigital.com/test/big.jpg
http://www.definitedigital.com/test/small.jpg

You'll notice that big.jpg is 34KB while small.jpg is only 7.5KB. Both have IPTC information but only big.jpg has EXIF information as well, so I'm guessing the heavy portion of the file is exactly this.

I've tried various approaches with Image-Magick, using Strip(), Composite(), etc, but I can't seem to find a way to keep the IPTC information and get rid of all the other profiles. If small.jpg is optimized so well, I'm guessing there is a way to remove EXIF and other unnecessary data.

Any help will be greatly appreciated.

Thanks and regards,
Ralph

  • Comment on Removing EXIF profiles with Perl Image-Magick

Replies are listed 'Best First'.
Re: Removing EXIF profiles with Perl Image-Magick
by ralphch (Sexton) on Sep 08, 2006 at 00:49 UTC

    Update: I just used the identify command and noticed that the IPTC profile for big.jpg is actually 21KB. There is a lot of gibberish in the profile that is not needed, and that small.jpg doesn't have. So I guess it has something to do with the application that was used to save the photo. Any ideas on how to remove this gibberish from the IPTC information?

    Thanks again and regards,
    Ralph

Re: Removing EXIF profiles with Perl Image-Magick
by zentara (Cardinal) on Sep 08, 2006 at 12:44 UTC
    Maybe Imge-ExifTool , or you could always put take screenshots of them off of your screen, and that could be automated.

    I did find this by googling for "EXIF remove perl" -> exifcleaner (untested by me ).


    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: Removing EXIF profiles with Perl Image-Magick
by ralphch (Sexton) on Sep 11, 2006 at 12:02 UTC

    Hi, thanks for the advice again!

    I have finally managed a way for achieving this optimization. I'm stripping out all of the Profiles from the new image with $image->Strip() and then creating a new IPTC Profile only with the information that I want. The IPTC handling is done with the Image::IPTCInfo module.

    This seems to be working quite well since it's reduced thumbnails that weighed 25KB to only 5KB. It takes around 1.5 seconds to process each one, so I guess it's ok.

    Thanks again and regards,
    Ralph

Re: Removing EXIF profiles with Perl Image-Magick
by Anonymous Monk on Sep 08, 2006 at 13:04 UTC

    Hi, thanks for your reply! I'm now removing the EXIF and XMP Profiles using $image->Profile(name=>'profilename',profile=>' ') for each. Is this method recommended?

    I'm also looking into how to remove the extra gibberish in the IPTC Profile. There's only a limited number of IPTC fields that I need, so is there a way to remove everything in the IPTC Profile except for a specified list of fields?

    Thanks and regards,
    Ralph

      I'm not familiar enough with all the different terms, to know what is the best way to do it. Have you looked at the exiftool utility script that comes with Image-ExifTool? A quick lookthru at it's perldoc, seems to indicate that you can rewrite the IPTC Profile using certain fields only. You may have to save the current info and delete it out of the file, then process it, and rewrite it into the file. The exiftools script has a very nice perldoc with examples for doing almost everything. It's a bit too complex for me to delve into "just for fun". :-)

      I'm not really a human, but I play one on earth. Cogito ergo sum a bum