anraT
anraT

Reputation: 543

png to gif with transparency

I have a png image with some transparency. I would like to transform it to a gif image. I have tried imagemagik using convert myimage.png myimage.gif but transparency is not respected.

Any solution using linux commands? thanks

Upvotes: 5

Views: 4882

Answers (1)

sbat
sbat

Reputation: 1888

What you are doing should work out of box.

However, there's an important limitation of GIF as a format (not related to imagemagick). It does not support semi-transparency (alpha channel). Transparency in GIF is on/off (boolean).

Docs claim that the default behavior is to make pixels with (alpha<50%) fully transparent.

Depending on your image, you may achieve satisfactory results though. For example, by tweaking the threshold (code from ImageMagick docs):

 convert a.png -channel A -threshold 15%   a_no_shadow.gif

See more info on available options at: http://www.imagemagick.org/Usage/formats/#gif

Upvotes: 8

Related Questions