Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Reading and displaying JPEG attributes

by tech2040 (Novice)
on Aug 10, 2005 at 23:06 UTC ( #482801=perlquestion: print w/replies, xml ) Need Help??

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

Hello all, I am currently a Perl novice. But a fast learner. I need help. I am trying to create a script that will read and display the file attributes(resolution, channels, bit depth, etc.) of jpeg files in a linux environment. I need to know if there are any scripts or tutorials available that will show me how to accomplish this. Any assistance will be greatly appreciated. Thank you.

Replies are listed 'Best First'.
Re: how do read & display file attributes
by chester (Hermit) on Aug 10, 2005 at 23:34 UTC
    Perhaps try Image::Info. It gives you what you want, plus plenty more. There's probably a module on CPAN to do most things you'll find yourself wanting to do.
      Thank you, But what about using itstat? And how would I print the information (specifically the file resolution)to the Linux console?
Re: how do read & display file attributes
by xdg (Monsignor) on Aug 11, 2005 at 00:09 UTC

    Other alternatives/tools include Imager instead of ImageMagick and Image::ExifTool if you need to read EXIF information.


    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: how do read & display file attributes
by greenFox (Vicar) on Aug 11, 2005 at 01:13 UTC

    Not strictly a Perl solution but ImageMagick comes with a utility called identify which prints out image attributes in a nice parseable format. Or you could use the Perl interface to ImageMagick, PerlMagick, which others have mentioned.

    Murray Barton
    Do not seek to follow in the footsteps of the wise. Seek what they sought. -Basho

Re: how do read & display file attributes
by Codon (Friar) on Aug 11, 2005 at 00:06 UTC
    You could try Image::Magick, as well. Very powerful, but a bear to install if you don't use a package management system.

    Ivan Heffner
    Sr. Software Engineer, DAS Lead, Inc.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://482801]
Approved by Tanktalus
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2022-10-07 09:48 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (29 votes). Check out past polls.