http://www.perlmonks.org?node_id=214294

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have written a script to open and process all the pixels of a *.jpg file. My problem is that I need a way to convert the different RGB values to colors, such as redish, blueish, greenish ect. After doing this i would also like perl to color a box with the color it said the pixel was. Any ideas/help/suggestions would be appreciated. Here is my code so far:
use GD; open IMA,"many.jpg" or die "NO file, $!"; binmode IMA; $image=new GD::Image->newFromJpeg(IMA); ($x,$y)=$image->getBounds(); for $ix (0..$x-1) { for $iy (0..$y-1) { ($r,$g,$b)=$image->rgb($im->getPixel($ix,$iy)); if($r ne $or) { printf "%2x%2x%2x\n",$r,$g,$b; print "$r, $g, $b\n"; #print "$image\n"; } $or = $r; } } close IMA;