Code Comments
Programming Forum and web based access to our favorite programming groups.Hello, I’d like to write a Perl script that returns the X and Y resolution of a given image file. Does anyone know of a module that might support this function? Ideally it would support a wide variety of image file formats. Thanks Tom --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.779 / Virus Database: 526 - Release Date: 10/19/2004
Post Follow-up to this messageTom Proctor wrote: > Hello, Hello, > I’d like to write a Perl script that returns the X and Y resolution of a > given image file. Does anyone know of a module that might support this > function? Ideally it would support a wide variety of image file > formats. Try: http://search.cpan.org/ Imager Image::Magick GD HTH :) Lee.M - JupiterHost.Net
Post Follow-up to this messageOn Sun, 24 Oct 2004, JupiterHost.Net wrote: > Tom Proctor wrote: > > > Try: > > http://search.cpan.org/ > > Imager > Image::Magick > GD Or, more to the point, Image::Size: use Image::Size; # Get the size of globe.gif ($globe_x, $globe_y) = imgsize("globe.gif"); # Assume X=60 and Y=40 for remaining examples use Image::Size 'html_imgsize'; # Get the size as 'width="X" height="Y"' for HTML generation $size = html_imgsize("globe.gif"); # $size == 'width="60" height="40"' use Image::Size 'attr_imgsize'; # Get the size as a list passable to routines in CGI.pm @attrs = attr_imgsize("globe.gif"); # @attrs == ('-width', 60, '-height', 40) use Image::Size; # Get the size of an in-memory buffer ($buf_x, $buf_y) = imgsize(\$buf); # Assuming that $buf was the data, imgsize() needed a reference to a scalar A brief search on CPAN or Google should have had this near the top of the list, had you tried to search before asking the list. If you're doing a lot of graphics work, the book _Perl Graphics Programming_ is good & worth taking a look at: <http://www.oreilly.com/catalog/perlgp/> -- Chris Devers
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.