use warnings; use strict; use GD::Simple; use Imager; $\="\n"; my @txt; $txt[0]=" GD::Simple <=> Imager"; my ($x1,$x2,$y)=(1375,1395,29); print "Line $y: Pixel $x1->$x2 "; my $png = GD::Image->newFromPng('test.png'); my ($width, $height) = $png->getBounds; print "GD::Simple Image dimensions: height = $height, width = $width"; for my $x ( $x1 .. $x2 ) { my @c=$png->rgb($png->getPixel($x,$y)); push (@txt,sprintf("%4d: [%3d,%3d,%3d]",$x,@c)); } my $i = Imager-> new; $i->read(file => 'test.png') or die "Cannot read: ", $i->errstr; $width = $i->getwidth(); $height = $i->getheight(); print "Imager Image dimensions: height = $height, width = $width\n"; for my $x ( $x1 .. $x2 ) { my $color = $i->getpixel( x => $x, y => $y ); my ( $r, $g, $b,$a ) = $color->rgba(); $txt[$x-$x1+1].=sprintf(" <=> %4d: [%3d,%3d,%3d]",$x,$r,$g,$b); } print $_ foreach @txt;