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

Hello all! Journalists use a standard format to encode all kinds of good information in their digital images. Photoshop has a way with dealing with this: File Information. Image::magick has "ATTRIBUTES" one can "GET" from images including "comment", but this attribute doesn't seem to contain the information that photoshop encodes into a JPEG....

I am using Image::Magick and Perl to extract this photoshop encoded information from uploaded JPEGS to put the information in a database, along with other image info obtained through image::magick (size, etc)....anyone out there dealt with "GET"ing the file information from a JPEG using Image::Magick and Perl?

Thanks!

"No matter where you go, there you are."

Jeff Pflueger - Struggling Perl knowledge sponge

  • Comment on Image::Magick and Photoshop File Information

Replies are listed 'Best First'.
Re: Image::Magick and Photoshop File Information
by thraxil (Prior) on Nov 20, 2001 at 22:26 UTC

    i've done a lot of work with storing xml meta-data in the comment fields of images so i've got a little experience with this. i'm not sure if photoshop uses the standard comment field of jpgs. if it does, i've found that the unix program 'rdjpgcom' will extract it much faster than Image::Magick.

    it was a while ago, but i'm thinking that photoshop actually used some other mechanism for storing comments though. i think it was some weird system of multiple numbered slots nearer to the end of the file (the standard comments field is right at the beginning).

    as a course of experimentation, i'd recommend making a very small jpg in photoshop and adding some comments to it. then run it through 'rdjpgcom' and 'identify -verbose' (identify comes with ImageMagick) and lastly open it up in a hex editor. if 'identify -verbose' can't show you the info you're looking for, you might be out of luck as far as using Image::Magick.

    anders pearson

Image::Magick is probably overkill
by petdance (Parson) on Nov 20, 2001 at 10:19 UTC
    What file information do you want out of the JPEG? If all you want is dimensions, take a look at the Image::Size module on the CPAN. There are probably other modules that will do read-only stuff on jpegs as well.

    If you're just looking for reading stuff from the file, Image::Magick may well be overkill.

    xoxo,
    Andy
    --
    <megaphone> Throw down the gun and tiara and come out of the float! </megaphone>

      I'm already using Image::magick for a host of other functions it is good at: changing image size, annotating, changing format. So to clarify: How can one use image::magick to get the "File Information" encoded by photoshop? (copyright, keywords, author, comments, etc..)This information doesn't seem to be put where ever the "comments" that image::magick can extract with a GET command....is there a way?

      Thanks!

      Did you check main Imagemagick site? I find that the docs there for the system as a whole are often more complete than for the PerlMagick modules.

      xoxo,
      Andy
      --
      <megaphone> Throw down the gun and tiara and come out of the float! </megaphone>