Converting PNG24 bit to PNG 8 bit

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
sskrao

Converting PNG24 bit to PNG 8 bit

Post by sskrao »

Hi,

I am trying to convert 24 bit PNG to 8 bit PNG. I used Convert command with -depth as 8. The identify command shows 8 bit depth but when I look at the file attributes in explorer it shows 24 bit. Also, after changing the depth to 8 bit, the file size did not get small instead remained where it was. When I do the same using GIMP, I can see the attribute changing to 8 bit and also file size reduces significantly. Any idea why this is happening?

Any help would be appreciated.

Thanks
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Converting PNG24 bit to PNG 8 bit

Post by Drarakel »

I recommend using a specialized tool for the last PNG output - like OptiPNG or PNGOut.
http://www.imagemagick.org/Usage/formats/#png_non-im
The filesize difference will usually be higher, too.

Your input file has already less than 256 colors - right? Well, there are ways to force it to palette (8bit) with ImageMagick - you could try one of these: "-type Palette", "PNG8:<outputfile>", "-define png:color-type=3", "-colors 256" etc. (Some of the options are explained in the link above.) But there are some bugs in the palette PNG output at the moment. So, use caution with the former options.
Post Reply