But OP is seeking "resolution" rather than width and height. See AM's output lines 123 & 124;
From perldoc Image::Info ( http://search.cpan.org/~gaas/Image-Info-1.16/lib/Image/Info.pm ).
resolution
The value of this field normally gives the physical size of the
image on screen or paper. When the unit specifier is missing then
this field denotes the squareness of pixels in the image.
The syntax of this field is:
<res> <unit>
<xres> "/" <yres> <unit>
<xres> "/" <yres>
The <res>, <xres> and <yres> fields are numbers. The <unit> is a
string like "dpi", "dpm" or "dpcm" (denoting "dots per
inch/cm/meter).
Update (at approx +12h after the above): I've tried numerous variants on OPs code (and that offered by the doc) with both .jpg and .tif. At least under W2k, those reproduced OP's problem -- to wit, that the package fails to return resolution for a tif.
One snippet:
my $res = $info->{resolution }; # NG for .tif and this doesn't work either {resolution res dpi } print "\t $res\n"; #line 23 # Use of uninitialized value in concatenation (.) or string at pl_ +test\796079.pl line 23.
Feed the script above this excerpt from an array of .tif and .jpg files, and it behaves for .jpg but not for .tif.
Also observed: the data extracted via:
my $info = image_info($img); if (my $error = $info->{error}) { die "Can't open image file: $error\n"; } print Dumper $info;
provides the expected info except for showing blank fields for 'YResolution' => '', and for 'XResolution' => '', when fed a .tif but provides values which match information (extracted by other means) from a .jpg.
Bug? or just /me in over my head?
In reply to Re^2: Image::info not working properly for tiff images
by ww
in thread Image::info not working properly for tiff images
by anusuya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |