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; #### Line 29: Pixel 1375->1395 GD::Simple Image dimensions: height = 2560, width = 1600 Imager Image dimensions: height = 2560, width = 1600 GD::Simple <=> Imager 1375: [ 4, 2, 4] <=> 1375: [ 1, 1, 1] 1376: [ 4, 2, 4] <=> 1376: [ 1, 1, 1] 1377: [ 4, 2, 4] <=> 1377: [ 1, 1, 1] 1378: [ 4, 2, 4] <=> 1378: [ 1, 1, 1] 1379: [ 12, 13, 12] <=> 1379: [ 11, 11, 11] 1380: [ 28, 28, 28] <=> 1380: [ 31, 31, 31] 1381: [ 68, 68, 68] <=> 1381: [ 61, 61, 61] 1382: [100,100,100] <=> 1382: [100,100,100] 1383: [100,100,100] <=> 1383: [102,102,102] 1384: [ 68, 68, 68] <=> 1384: [ 68, 68, 68] 1385: [ 52, 52, 52] <=> 1385: [ 48, 48, 48] 1386: [ 36, 34, 36] <=> 1386: [ 40, 40, 40] 1387: [ 36, 34, 36] <=> 1387: [ 33, 33, 33] 1388: [ 20, 26, 28] <=> 1388: [ 26, 26, 26] 1389: [ 20, 20, 20] <=> 1389: [ 20, 20, 20] 1390: [ 12, 13, 12] <=> 1390: [ 14, 14, 14] 1391: [ 4, 10, 12] <=> 1391: [ 9, 9, 9] 1392: [ 4, 6, 4] <=> 1392: [ 6, 6, 6] 1393: [ 4, 2, 4] <=> 1393: [ 4, 4, 4] 1394: [ 4, 2, 4] <=> 1394: [ 2, 2, 2] 1395: [ 4, 2, 4] <=> 1395: [ 1, 1, 1]