Skip Menu |

This queue is for tickets about the Image-Info CPAN distribution.

Report information
The Basics
Id: 117480
Status: open
Priority: 0/
Queue: Image-Info

People
Owner: Nobody in particular
Requestors: jlpoole56 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 1.24
  • 1.38
  • 1.39
Fixed in: (no value)



Subject: Image::Info TIFF - Resolution & other properties fail
My attempt to determine the resolution of a TIFF file is failing. I also tested some other properties and here's where no values were returned: resolution Interlace Gamma LastModificationTime color_type Attached is a Perl script demonstrating the problem as well as the TIFF file used. The "resolution" should always returns something, yes?
Subject: EVE0002.TIF
Download EVE0002.TIF
image/tiff 835.3k
EVE0002.TIF
Subject: test_tiff2.pl
use strict; use warnings; use Image::Info qw(image_info dim); my $file = 'D:\work\EP\sample\EVE0002.TIF'; my $info = image_info($file); my $width = $info->{width}; my $height = $info->{height}; my $resolution = $info->{resolution}; my $samples_per_pixal = $info->{SamplesPerPixel}; my $interlace = $info->{Interlace}; my $compression = $info->{Compression}; my $gamma = $info->{Gamma}; my $last_mod = $info->{LastModificationTime}; my $bitspsample = $info->{BitsPerSample}; my $color_type = $info->{color_type}; print "width = $width\theight = $height\tresolution = $resolution\n"; print "SamplesPerPixel = $samples_per_pixal\n"; print "Interlace = $interlace\n"; print "Compression = $compression\n"; print "Gamma = $gamma\n"; print "LastModificationTime = $last_mod \n"; print "BitsPerSample = $bitspsample\n"; print "color_type = $color_type\n"; __END__ D:\work\EP\perl\trunk\perl>perl test_tiff2.pl Use of uninitialized value $resolution in concatenation (.) or string at test_tiff2.pl line 12. width = 3246 height = 4223 resolution = D:\work\EP\perl\trunk\perl> cpan> i Bundle::Image::Info::Everything Database was generated on Sun, 04 Sep 2016 01:15:55 GMT Bundle id = Bundle::Image::Info::Everything CPAN_USERID SREZIC (Slaven Rezic <slaven@rezic.de>) CPAN_VERSION 0.01 CPAN_FILE S/SR/SREZIC/Image-Info-1.38.tar.gz UPLOAD_DATE 2015-04-20 MANPAGE Bundle::Image::Info::Everything - complete support for Image::Info CONTAINS Image::Info Compress::Zlib XML::LibXML::Reader XML::Simple Image::Xbm Image::Xpm INST_FILE C:\Strawberry32\perl\site\lib\Bundle\Image\Info\Everything.pm INST_VERSION 0.01 cpan> i Image::Info::TIFF Module id = Image::Info::TIFF CPAN_USERID SREZIC (Slaven Rezic <slaven@rezic.de>) CPAN_VERSION 0.04 CPAN_FILE S/SR/SREZIC/Image-Info-1.38.tar.gz UPLOAD_DATE 2015-04-20 MANPAGE Image::Info::TIFF - TIFF support for Image::Info INST_FILE C:\Strawberry32\perl\site\lib\Image\Info\TIFF.pm INST_VERSION 0.04 cpan>
On 2016-09-03 22:32:30, jlpoole wrote: Show quoted text
> My attempt to determine the resolution of a TIFF file is failing. I > also tested some other properties and here's where no values were > returned: > > resolution > Interlace > Gamma > LastModificationTime > color_type > > Attached is a Perl script demonstrating the problem as well as the > TIFF file used. > > The "resolution" should always returns something, yes?
Yes, it seems that rational numbers were broken since Image::Info 1.24. With the following patch there are the fields XResolution and YResolution which should say something like 4000000/10000: diff --git i/lib/Image/Info/TIFF.pm w/lib/Image/Info/TIFF.pm index 9e1711b..2c28131 100644 --- i/lib/Image/Info/TIFF.pm +++ w/lib/Image/Info/TIFF.pm @@ -161,9 +161,11 @@ sub _process_ifds { @$val = _readbytes($fh, $value_offset, $count - 1); } elsif ($fieldtype == 5) { ## Unsigned Rational + $val = []; _readrational($fh,$value_offset,$byteorder,$count,$val,0); } elsif ($fieldtype == 10) { ## Signed Rational + $val = []; _readrational($fh,$value_offset,$byteorder,$count,$val,1); } else { ## Just read $count thingies from the offset
On 2016-11-03 17:51:33, SREZIC wrote: Show quoted text
> On 2016-09-03 22:32:30, jlpoole wrote:
> > My attempt to determine the resolution of a TIFF file is failing. I > > also tested some other properties and here's where no values were > > returned: > > > > resolution > > Interlace > > Gamma > > LastModificationTime > > color_type > > > > Attached is a Perl script demonstrating the problem as well as the > > TIFF file used. > > > > The "resolution" should always returns something, yes?
> > Yes, it seems that rational numbers were broken since Image::Info > 1.24. With the following patch there are the fields XResolution and > YResolution which should say something like 4000000/10000: > > diff --git i/lib/Image/Info/TIFF.pm w/lib/Image/Info/TIFF.pm > index 9e1711b..2c28131 100644 > --- i/lib/Image/Info/TIFF.pm > +++ w/lib/Image/Info/TIFF.pm > @@ -161,9 +161,11 @@ sub _process_ifds { > @$val = _readbytes($fh, $value_offset, $count - 1); > } elsif ($fieldtype == 5) { > ## Unsigned Rational > + $val = []; > _readrational($fh,$value_offset,$byteorder,$count,$val,0); > } elsif ($fieldtype == 10) { > ## Signed Rational > + $val = []; > _readrational($fh,$value_offset,$byteorder,$count,$val,1); > } else { > ## Just read $count thingies from the offset
Reolution should be fixed with 1.39_50. Please re-open if something is missing here.
Subject: Re: [rt.cpan.org #117480] Resolved: Image::Info TIFF - Resolution & other properties fail
Date: Wed, 12 Jul 2017 10:16:43 -0700
To: bug-Image-Info [...] rt.cpan.org
From: John Laurence Poole <jlpoole56 [...] gmail.com>
I downloaded my Perl script and TIFF image, modified the Perl script to point to the TIFF image on LInux. I'm not seeing anything different than before. jlpoole@themis ~/work/test $ perl test_tiff2.pl Use of uninitialized value $resolution in concatenation (.) or string at test_tiff2.pl line 20. width = 3246 height = 4223 resolution = SamplesPerPixel = 1 Use of uninitialized value $interlace in concatenation (.) or string at test_tiff2.pl line 22. Interlace = Compression = LZW Use of uninitialized value $gamma in concatenation (.) or string at test_tiff2.pl line 24. Gamma = Use of uninitialized value $last_mod in concatenation (.) or string at test_tiff2.pl line 25. LastModificationTime = BitsPerSample = 8 Use of uninitialized value $color_type in concatenation (.) or string at test_tiff2.pl line 27. color_type = jlpoole@themis ~/work/test $ cpan Loading internal null logger. Install Log::Log4perl for logging messages Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v2.16) Enter 'h' for help. cpan[1]> i Image::Info Module id = Image::Info CPAN_USERID SREZIC (Slaven Rezic <slaven@rezic.de>) CPAN_VERSION 1.41 CPAN_FILE S/SR/SREZIC/Image-Info-1.41.tar.gz UPLOAD_DATE 2017-07-12 MANPAGE Image::Info - Extract meta information from image files INST_FILE /home/jlpoole/perl5/lib/perl5/Image/Info.pm INST_VERSION 1.41 cpan[3]> i Image::Info::TIFF Module id = Image::Info::TIFF CPAN_USERID SREZIC (Slaven Rezic <slaven@rezic.de>) CPAN_VERSION 0.05 CPAN_FILE S/SR/SREZIC/Image-Info-1.41.tar.gz UPLOAD_DATE 2017-07-12 MANPAGE Image::Info::TIFF - TIFF support for Image::Info INST_FILE /home/jlpoole/perl5/lib/perl5/Image/Info/TIFF.pm INST_VERSION 0.05 cpan[4]> q Terminal does not support GetHistory. Lockfile removed. jlpoole@themis ~/work/test $ On Wed, Jul 12, 2017 at 9:39 AM, Slaven_Rezic via RT < bug-Image-Info@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=117480 > > > According to our records, your request has been resolved. If you have any > further questions or concerns, please respond to this message. >
-- John L. Poole P.O. Box 6566 Napa, CA 94581-6566 707-812-1323 <%28707%29%20812-1323> jlpoole56@gmail.com