Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / June 2005



Tip: Looking for answers? Try searching our database.

Parsing Jpeg files for comments

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robin - 08 Jun 2005 08:15 GMT
I've googled about for this but to no avail:

I'm making a perl frontend to a mySQL server to serve up images. Some
of the images are jpegs with keywords stored as comments in the file,
and I want to be able to access those comments through perl. Is there a
module which already exists which does this?

tia

Robin
John Horner - 08 Jun 2005 08:31 GMT
>I want to be able to access those comments through perl. Is there a
>module which already exists which does this?

Not what you asked for, but this site:

http://osx.freshmeat.net/projects/libjpeg/

has an OS X version of "rdjpegcom" which is a system tool for reading
JPG comments.
Paul Mison - 08 Jun 2005 08:41 GMT
>>I want to be able to access those comments through perl. Is there a
>>module which already exists which does this?
[quoted text clipped - 3 lines]
>has an OS X version of "rdjpegcom" which is a system tool for reading
>JPG comments.

Oh, JFIF comments? Either JPEG::JFIF or  or the scarily comprehensive
looking Image::Metadata::JPEG might be better than the other two
modules I just mentioned.

http://search.cpan.org/~krzak/JFIF/JFIF.pm
http://search.cpan.org/~bettelli/Image-MetaData-JPEG/lib/Image/MetaData/JPEG.pod

:: paul
:: historic light cone
Paul Mison - 08 Jun 2005 08:33 GMT
>I'm making a perl frontend to a mySQL server to serve up images. Some
>of the images are jpegs with keywords stored as comments in the file,
>and I want to be able to access those comments through perl. Is there
>a module which already exists which does this?

If the comments are EXIF, there's an Image::EXIF library on CPAN:

http://search.cpan.org/~ccpro/Image-EXIF/EXIF.pm

If they use IPTC instead, there're libraries for that, too:

http://search.cpan.org/~jcarter/Image-IPTCInfo/IPTCInfo.pm

There are alternatives to both of these modules, I believe, but
hopefully the names of the metadata formats will help you to get
started.

:: paul
:: historic light cone
Chris Devers - 08 Jun 2005 12:01 GMT
> I've googled about for this but to no avail:

Try search.cpan.org next time :-)

> I'm making a perl frontend to a mySQL server to serve up images. Some
> of the images are jpegs with keywords stored as comments in the file,
> and I want to be able to access those comments through perl. Is there
> a module which already exists which does this?

Yes:  Image::Info.

   <http://search.cpan.org/~gaas/Image-Info/lib/Image/Info.pm>

Quoting from that page...

   SYNOPSIS

    use Image::Info qw(image_info dim);

    my $info = image_info("image.jpg");
    if (my $error = $info->{error}) {
        die "Can't parse image info: $error\n";
    }
    my $color = $info->{color_type};

    my($w, $h) = dim($info);

Accessing the comment field is a one-line change to this block.

Helpful?

Signature

Chris Devers

np: 'Everything to Play For'
    by Douglas Adams
    from 'H2G2: The Tertiary Phase'

Robin - 09 Jun 2005 06:58 GMT
>> I've googled about for this but to no avail:
>
> Try search.cpan.org next time :-)

I'm hurt you think I didn't :)

> Yes:  Image::Info.

this was the first thing I found and downloaded and is great for  
getting info about the jpeg itself, but not what I needed in this  
particular case.

On 8 Jun 2005, at 16:41, Paul Mison wrote:

> Oh, JFIF comments? Either JPEG::JFIF or  or the scarily comprehensive  
> looking Image::Metadata::JPEG might be better than the other two  
[quoted text clipped - 3 lines]
> http://search.cpan.org/~bettelli/Image-MetaData-JPEG/lib/Image/ 
> MetaData/JPEG.pod

Ah hah! it looks like I was using the wrong terms to search, hence  
drawing blanks, ahh the curse of jargon. This indeed looks like what I  
need - tankee sir.

Robin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.