Convert PNG32 to PNG8 with alpha transparency
Posted: 2007-10-01T09:40:11-07:00
Hello,
I have over 200,000 images stored as transparent PNGs. I need to convert each to an alpha transparent, grayscale PNG. The settings of this PNG must match a specific format to be compatible with a GD and ImageMagick driven system.
Right now, I can't seem to get the right kind of output to match what I can produce out of Fireworks. I have also posted test cases including sample files. I've tried dozens of variations to achieve my goal but none of them are right.
Also, you can download the sample files directly:
Sample Original File
Desired Output File
Basically, I want to duplicate these export settings from Fireworks:
I can get the conversion to an alpha transparent grayscale. But I can't get PNG 8 output to work with alpha transparency. And it seems there should be a more elegant method than building all these intermediate images...
Any ideas anyone can recommend are much appreciated. Thanks!
I have over 200,000 images stored as transparent PNGs. I need to convert each to an alpha transparent, grayscale PNG. The settings of this PNG must match a specific format to be compatible with a GD and ImageMagick driven system.
Right now, I can't seem to get the right kind of output to match what I can produce out of Fireworks. I have also posted test cases including sample files. I've tried dozens of variations to achieve my goal but none of them are right.
Also, you can download the sample files directly:
Sample Original File
Desired Output File
Basically, I want to duplicate these export settings from Fireworks:
I can get the conversion to an alpha transparent grayscale. But I can't get PNG 8 output to work with alpha transparency. And it seems there should be a more elegant method than building all these intermediate images...
Code: Select all
convert -size 634x668 xc:white -matte white.png
convert -size 634x668 xc:black -matte black.png
convert \( original.png -quantize GRAY -colors 256 \) grayed.png
composite -compose Dst_Over white.png grayed.png grayed_flat.png
convert black.png \( grayed_flat.png -negate \) +matte -compose Copy_Opacity -composite -depth 8 -colors 16 composite_copy_opacity.png