Windows Version: ImageMagick 7.0.8-5 Q16 x64 on Windows 10
I'm using PerlMagick and I need to reduce images down to the following basic colors:
0x000000 (black)
0x0000FF (blue)
0x00FF00 (green)
0x00FFFF (cyan, or html aqua)
0xFF0000 (red)
0xFF00FF (magenta, or html fuchsia)
0xFFFF00 (yellow)
0xFFFFFF (white)
I've been playing with posterize but I can't quite figure out how to make sure that those are the only colors in the output.
It works great in Win10 with the following command:
Code: Select all
magick input.png -posterize 2 output.png
Code: Select all
$image->Read("input.png");
$image->Posterize(levels => 2, dither => 'false'); # dither doesn't make a difference either way
$image->write('output.png');
Code: Select all
160392: ( 0, 0, 0,255) #000000FF black
8: ( 0, 0, 0,213) #000000D5 srgba(0,0,0,0.835294)
7: ( 0, 0, 0,230) #000000E6 srgba(0,0,0,0.901961)
6: ( 0, 0, 0,250) #000000FA srgba(0,0,0,0.980392)
3: ( 0, 0, 0,244) #000000F4 srgba(0,0,0,0.956863)
1013: ( 0,255,255,255) #00FFFFFF cyan
570: (125, 25,130,255) #7D1982FF srgba(125,25,130,1)
88001: (255,255,255,255) #FFFFFFFF white