Code: Select all
use strict;
use Image::Magick;
print "PERL: $^V\nIM: ", Image::Magick->new->Get('version'), "\n\n";
my $img = Image::Magick->new;
$img->Read('logo:');
$img->Quantize(colorspace=>'gray',colors=>10);
for( my $i = 0; $i < 10; $i++ ){
print $i, "\t", $img->Get("colormap[$i]"),"\n";
}
The colormap index 4 is not a grayscale color and if I try to set that particular index I get a fatal error. If I reduce the colors first and then convert to gray everything works as expected. However, converting to gray first and then reducing the colors still yields a bad colormap.PERL: v5.10.0
IM: ImageMagick 6.4.0 04/23/08 Q16 http://www.imagemagick.org
0 10536,10536,10536,0
1 20362,20362,20362,0
2 41849,41849,41849,0
3 65247,65247,65247,0
4 4179,5,267,256
5 20362,20362,20362,0
6 41849,41849,41849,0
7 65247,65247,65247,0
8 10536,10536,10536,0
9 20362,20362,20362,0