PNG 32 - PNG 8 with indexed transparency
Posted: 2011-02-04T15:45:39-07:00
Hi there, I thought this would be a fairly simple question but nothing I've tried so far has worked!
I have a load of png images, which I want to first -trim, and then convert to 16-colour indexed palette png 8s, including a transparency colour.
I got as far as trimming, and almost got transparency. The command was:
That got me transparency, but all black in the image was also transparent.
I assume it's something to do with the original png being black where it's transparent, and transparency not being a colour in the original for -colors 16 to use. If I knew how, at this point I would probably do this:
Overlay the transparent image onto a (255,0,255) background
Convert to indexed colour
Change (255,0,255) to (255,0,255,0) in the colormap.
How can I do this with command-line Imagemagick?
Thanks very much for any insight!
I have a load of png images, which I want to first -trim, and then convert to 16-colour indexed palette png 8s, including a transparency colour.
I got as far as trimming, and almost got transparency. The command was:
Code: Select all
convert source.png -trim -depth 8 -colors 16 result.png
I assume it's something to do with the original png being black where it's transparent, and transparency not being a colour in the original for -colors 16 to use. If I knew how, at this point I would probably do this:
Overlay the transparent image onto a (255,0,255) background
Convert to indexed colour
Change (255,0,255) to (255,0,255,0) in the colormap.
How can I do this with command-line Imagemagick?
Thanks very much for any insight!