Get RGB value of a pixel

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
Zeokat

Get RGB value of a pixel

Post by Zeokat »

Code: Select all

my @pixel = $image_magick->GetPixel(x=>"$i",y=>"$j");
print @pixel,"\n";
0.898039215686275 0.898039215686275 0.898039215686275

I obtain these values... how can i get the rgb values?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Get RGB value of a pixel

Post by magick »

The pixel values are normalized. The first value is red, the second green, and the third of course is blue. If you want traditional pixel values from [ 0 .. 255 ], simply multiply by 255.0.
Post Reply