#! perl -slw use strict; use GD; my $img = GD::Image->new( $ARGV[ 0 ] ); my( $w, $h ) = $img->getBounds; print "The image '$ARGV[ 0 ]' is $w x $h pixels."; printf "The color of the pixel in the middle is: [0x%02x:0x%02x:0x%02x].\n", $img->rgb( $img->getPixel( $w/2, $h/2 ) ); __DATA__ c:\test>junk5 694790clustered.png The image '694790clustered.png' is 800 x 800 pixels. The color of the pixel in the middle is: [0xfc:0xfe:0xfc]. c:\test>junk5 img\worldx2-2.jpg The image 'img\worldx2-2.jpg' is 5400 x 2700 pixels. The color of the pixel in the middle is: [0x04:0x0c:0x11]. c:\test>junk5 img\gradient.gif The image 'img\gradient.gif' is 108 x 108 pixels. The color of the pixel in the middle is: [0xff:0xff:0xff].