On Thu, Jul 20, 2006 at 04:35:46PM -0400, via RT wrote:
Show quoted text> Reading a tiff image and using getpixel...
>
>
> my $imager = Imager->new;
> $imager->read(file => 'imager.tiff', type => 'tiff');
>
> my $col = $imager->getpixel(x => 1, y => 1);
>
>
> ... gives this error:
>
> Use of uninitialized value in subroutine entry at
> /opt/perl/perl-5.8.8/lib/site_perl/5.8.8/i686-linux/Imager.pm line 2578.
> Use of uninitialized value in subroutine entry at
> /opt/perl/perl-5.8.8/lib/site_perl/5.8.8/i686-linux/Imager.pm line 2578.
> im is not of type Imager::ImgRaw at
> /opt/perl/perl-5.8.8/lib/site_perl/5.8.8/i686-linux/Imager.pm line 2578.
This probably means that Imager is failing to read the TIFF file, try
adding an error handling clause to the read, so for example:
$imager->read(file => 'imager.tiff', type => 'tiff')
or die "Cannot read: ", $imager->errstr;
If the message you get isn't enlightening, please run tiffdump on the
image file, and supply me the output. Or supply the TIFF if it isn't
too big.
There have been some improvements in TIFF support in 0.51_03 (for 0.52
when it comes out), that may have fixed your problem. Or it may not
have, TIFF is complex.
I'm planning on improving Imager's TIFF support over the long term,
but it's a complex format.
==
There's still a bug here, that getpixel() isn't checking for a live
object before calling the low level function to get the pixel
information. I'm not planning on fixing this for 0.52 since it's an
old but minor problem, but I'll look at it for 0.53.
Tony