Saving PNGs with color type 3 (Palette)
Posted: 2008-05-29T02:53:25-07:00
I'm trying to save PNG with color type 3 using ImageMagick:
Source image has color type 3 (PALETTE).
> convert image.png image_out.png
Image_out.png has color type 6 (RGBA).
> convert -type Palette image.png image_out.png
Image_out.png has color type 2 (RGB).
Currently I'm saving to GIF as workaround:
convert image.png image_out.gif
pngout /kp image_out.gif image_out.png
Image_out.png has color type 3 (PALETTE).
But this has a side effect: resulting palette is larger than needed (GIF palette size are 256, 128, 64 etc colors, unused colors are filled with zeros). I can't let pngout remap palette colors (/kp switch disables this) and drop unused ones because I use the same palette for different images.
Is there a way to save palettized PNG directly from ImageMagick?
Source image has color type 3 (PALETTE).
> convert image.png image_out.png
Image_out.png has color type 6 (RGBA).
> convert -type Palette image.png image_out.png
Image_out.png has color type 2 (RGB).
Currently I'm saving to GIF as workaround:
convert image.png image_out.gif
pngout /kp image_out.gif image_out.png
Image_out.png has color type 3 (PALETTE).
But this has a side effect: resulting palette is larger than needed (GIF palette size are 256, 128, 64 etc colors, unused colors are filled with zeros). I can't let pngout remap palette colors (/kp switch disables this) and drop unused ones because I use the same palette for different images.
Is there a way to save palettized PNG directly from ImageMagick?