#! perl -slw use strict; use GD; GD::Image->trueColor( 1 ); my $img1 = GD::Image->new( $ARGV[ 0 ] ); my $img2 = GD::Image->new( $ARGV[ 1 ] ); die "Different dimensions" unless $img1->width == $img2->width and $img1->height == $img2->height; my $raw1 = $img1->gd; my $raw2 = $img2->gd; if( $raw1 ne $raw2 ) { print "images are different"; printf "Process pixels? "; ; for my $y ( 0 .. $img1->height -1 ) { for my $x ( 0 .. $img1->width -1 ) { my $p1 = $img1->getPixel( $x, $y ); my $p2 = $img2->getPixel( $x, $y ); if( $p1 != $p2 ) { print "Difference at ($x:$y): [@{[ $img1->rgb( $p1 ) ]}] .v. [@{[ $img2->rgb( $p2 ) ]}]"; } } } } else { print "Images are the same"; } __END__