kruzzik on wrote...
|
| What is the correct command line to convert an image to a png8 with 8-bits
| palette 332 (RGB 332 mode) dithering FloydSteinberg?
| Thanks!
Well first of all IM currently does not implement FloydSteinberg
dithering, or so I have been told by the developers. It is using a
Hilbret Curve Dither, which is still very reasonable. I have requested
an expandsion of the -dither (or -define) options to add extra dither
options for the -colors, -map, and -monchrome operators.
Now the next thing you need is a 332 pallet. That is 3 bits red, 3
green, and 2 for blue. This would also be known as a 8x8x4 pallet, and
consists of 256 colors.
I hope you don't plan on using transparency, unless you make one of the
unused colors transparent, as that is a completely filled out color
table.
If you have an image with those colors in it you can shrink it to a
332 colormap using...
convert image.png -unique-colors colormap_332.png
Make sure you the final image is sized 256x1, or you did not get
all the colors.
Or you can try to generate it yourself mathematically, in a simular way
that the built-in netscape: 6x6x6 colormap
Hmm...
convert xc:'[16x16]' -channel R -fx '(i&7)/7' \
-channel G -fx '(j&7)/7' \
-channel B -fx '(((i&8)>>3)|((j&8)>>2))/3' \
colormap_332.png
WARNING: Bitwise operators in IM -fx was broken except in the latest IM
beta release v6.2.9-1 as it was only just discovered in the last set of new IM
Examples (DIY Ordered Dithering). If that is a problem use...
convert xc:'[16x16]' -channel R -fx '(i%8)/7' \
-channel G -fx '(j%8)/7' \
-channel B -fx '(floor(i/8)%2+(floor(j/8)%2)*2)/3' \
colormap_332.png
You can scale it to the same size as the built-in netscape: color map
by adding a -scale 1200% before the final save filename.
I will be placing this on the 'Color Reduction' page of IM examples
shortly.
You can then use it like this
convert image.png -map colormap_332.png image_332_dithered.png
Thanks for the kick to get this done, i'd been meaning to do it.
I also want to add the 'macintosh web-safe color map' pallet,
which is the same as "netscape:" but with extra grey-scale colors
which these mathematical colormaps handle poorly.
Perhaps this can be added as a extra IM built-in? Chrisy?
Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
"Virtual machines?" asked Moira.
"That's like a computer that isn't there." Jerry said helpfully
-- Rick Cook, "The Wizardry Cursed"
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users