my $image = GD::Image->newFromPng($filename); my ($height, $width) = $image->getBounds; foreach my $x ( 0 .. $width ) { foreach my $y ( 0 .. $height ) { my ($index) = $image->getPixel($x,$y); my ($r,$g,$b) = $image->rgb($index); print "($x,$y) -> ($r,$g,$b)\n"; } }