GetPixel failing
Posted: 2012-04-30T03:09:10-07:00
I'm really puzzled
the "identify" command returns " JPEG 205x154 205x154+0+0 8-bit DirectClass 48KiB 0.000u 0:00.000" on the image, and it is a color photo I can see with lots of multicolored flowers.
when I read it into PerlMagick and iterate over every pixel, like this...
I get:
unique colors :
0.141176470588235,0.152941176470588,0.211764705882353 : 31570
for a black & white tiff I get only "1,1,1" (white)
What am I doing wrong?
thanks
the "identify" command returns " JPEG 205x154 205x154+0+0 8-bit DirectClass 48KiB 0.000u 0:00.000" on the image, and it is a color photo I can see with lots of multicolored flowers.
when I read it into PerlMagick and iterate over every pixel, like this...
Code: Select all
for(my $i=1; $i<=$width; $i++) {
for(my $j=1; $j<=$height; $j++) {
my @rgb=$image->GetPixel($i,$j);
$colors{join(',', @rgb)}++;
}
}
print "\n unique colors : \n";
foreach $k (keys %colors) {
print "\n $k : ", $colors{$k};
}
unique colors :
0.141176470588235,0.152941176470588,0.211764705882353 : 31570
for a black & white tiff I get only "1,1,1" (white)
What am I doing wrong?
thanks