Page 1 of 1

Old VS New ImageMagick BMP to Transparent PNG

Posted: 2011-09-22T02:08:34-07:00
by BDIL
Recently we had to move to a new server with a new imagemagick version. We always used the following to convert BMP's to transparent PNG's:

convert -limit memory 256mb -limit map 512mb TEST.bmp -transparent white -depth 8 -type PaletteMatte -shave 1x1 TEST.png

On the new server however the result is much different. The old server had ImageMagick 6.3.7, the new server version 6.6.2-6

On the old server I got a PNG with BitDepth 2, ColorType 3 and chunks: IHDR, PLTE, tRNS, BKGD, vpAG, IDAT and IEND
On the new server I get a PNG with BitDepth 8, ColorType 6 and chucks: IHDR BKGD, vpAG, IDAT, IDAT, tEXt, tEXt and IEND

The problem is that I am obligated to get a PNG with PLTE, tRNS chunks, BitDepth 2, ColorType 3. How would I achieve this result?

Re: Old VS New ImageMagick BMP to Transparent PNG

Posted: 2011-09-22T09:56:45-07:00
by fmw42
PNG has undergone quite some development, though there are still some issues with -type. You might try upgrading. You might also try removing the -type palettmatte (what you need, though I don't see that option is -type bilevelmatte, though png may not support that) and then add PNG8: to your result image.

try this, though no guarantee that it will work:

convert -limit memory 256mb -limit map 512mb TEST.bmp -transparent white -depth 8 -shave 1x1 PNG8:TEST.png

The PNG developer will have to comment further as I am not an expert on PNG.

Re: Old VS New ImageMagick BMP to Transparent PNG

Posted: 2011-09-22T19:53:46-07:00
by glennrp
Try this.

Code: Select all

convert -limit memory 256mb -limit map 512mb TEST.bmp -transparent white  -colors 3  -shave 1x1 TEST.png
Your input file probably has only 4 colors or less, including the transparent color, so you can omit the "-colors 3".
You don't want to use PNG8 because that will force the bit-depth to be 8.