PNG 8bit monochrome, how?
Posted: 2009-12-11T13:33:47-07:00
Using ImageMagick 6.5.1-0 2009-08-27 Q16 OpenMP
I need to convert a colored image to an 8 bit monochrome PNG. Not a grayscale PNG nor a 1/2/4/16/24/32 bit PNG, but 8 bit with the only colors in the palette being black and white. Yes, I know that is silly, but that is what I need.
My current closest attempt is:
However, that produces a 1 bit paletted PNG. Very close to what I want, but not quite...
If I leave out the PNG8: or use -colors 2 then it becomes a grayscale PNG.
If I add -depth 8 or -define png:color-type=3 or -define png:bit-depth=8 or combinations thereof, it has no effect.
What is the magic combination to make IM do as I want?
I need to convert a colored image to an 8 bit monochrome PNG. Not a grayscale PNG nor a 1/2/4/16/24/32 bit PNG, but 8 bit with the only colors in the palette being black and white. Yes, I know that is silly, but that is what I need.
My current closest attempt is:
Code: Select all
convert 32bitcolors.png -alpha off -dither None -monochrome PNG24:tmp.png
convert tmp.png -depth 8 -colors 256 PNG8:blackwhite.png
If I leave out the PNG8: or use -colors 2 then it becomes a grayscale PNG.
If I add -depth 8 or -define png:color-type=3 or -define png:bit-depth=8 or combinations thereof, it has no effect.
What is the magic combination to make IM do as I want?