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

I have a database in which each node is a hyperlink. I want to identify which links are to .jpg files and extract as much info as possible from the header of the files.

Has anyone done something like this before? What libraries should I look at to get started?

Thanks for your time -tlynch

Replies are listed 'Best First'.
Re: decode jpg header
by dws (Chancellor) on Feb 20, 2001 at 04:07 UTC
    Image::Size will give you the dimensions of a jpg. That's a start.

      Image::Size, I have to admit, is very slick. I was porting an old program of mine that unpacked GIF and JPG, but decided to check CPAN just for the heck of it. Sure enough, there was this gem.

      For something so simple in concept, it is implemented quite thorougly. It will parse many different formats, and it returns the information in a highly dynamic way, so you can literally drop the results into CGI.pm for your <IMG> tag. Very interesting.

      From the docs:
      $r->print($Q->img({-src => $imgpath, attr_imgsize($r->lookup_uri($imgpath)->filename +) }));
(ichimunki) re: decode jpg header
by ichimunki (Priest) on Feb 20, 2001 at 04:15 UTC
Re: decode jpg header
by magnus (Pilgrim) on Feb 20, 2001 at 15:25 UTC
    seems after looking at both Image:Size and Image::Info you should be able to get what you need...

    Image::Info gives you more information, though the sizing in returned differently, it seems...

    be careful, as there are slight differences in what formats are supported between them (e.g.: Image::Info doesn't seem to support TIF, tho it does support ASCII)... good luck, and very cool find ichimunki...

    magnus
Re: decode jpg header
by strredwolf (Chaplain) on Feb 22, 2001 at 09:36 UTC
    Even though Image::Size can do the trick, if you're also doing some processing, ImageMagick's PerlMagick can also do it too. I use that for comic strip compiler.

    --
    $Stalag99{"URL"}="http://stalag99.keenspace.com";