TheGeekGuy
TheGeekGuy

Reputation: 137

ImageMagick: How to not save background color information?

How - if at all - is it possible to create a fully transparent image with ImageMagick?

The problem: It's always getting a background color, white by default (as per docs)

More specifically, looking for: Not even a single background color stored in the file, so that every viewer that supports PNG will see it as a fully transparent image - just like the input

My commandline is:

magick convert in.png -trim out.png

Upvotes: 0

Views: 47

Answers (1)

fmw42
fmw42

Reputation: 53089

Standard "transparent" is a zero valued alpha channel over a black background, so rgba(0,0,0,0). If you want to ensure such, then make the background black under the transparent areas. So for example from your command assuming in.png has some transparency:

magick in.png -background black -alpha background -trim +repage out.png


Note that in ImageMagick 7, use magick, not magick convert.

Upvotes: 1

Related Questions