Page 1 of 1

Batch Convert png24 files to png8 preserving transparency

Posted: 2014-02-24T13:46:27-07:00
by thatfellow
I have about 5000 png24 files that I need converted to png8 preserving all transparency data..
Is this possible through terminal with image magick?

I have tried pngquant but no success, I kept getting this error :
NOTE: the -map option is NOT YET SUPPORTED.

Re: Batch Convert png24 files to png8 preserving transparenc

Posted: 2014-02-24T14:37:51-07:00
by fmw42
PNG24 (24-bit color) does not include any transparency. Do you mean PNG32 (24-bit color with 8-bit transparency)?


If so, the use mogrify to convert all the images in a folder

Assume image are in folder1 and you have an empty folder2 in which to put the output images (so you do not overwrite your input images)

Code: Select all

cd folder1
mogify -path path2/folder2 -format png -type palettealpha *.png
Generally when doing this with convert, you will get the same results, but I thought that palettealpha data had binary alpha as when using PNG8:image.png for output. But with only -type palettealpha it seems to keep the 8-bit transparency, which is not what I thought was supported.

Code: Select all

convert logo: -transparent white PNG32:logo.png
convert logo.png -alpha on -channel a -blur +channel logo.png
The above makes a 32-bit png.

Code: Select all

convert logo.png -type palettealpha logo2.png 
give 8-bit alpha

but

Code: Select all

convert logo.png PNG8:logo3.png
gives binary alpha.