Question

I an trying to use Image Magick to create a new large png from several small png's but the smaller image do not have their transparency preserved. I am creating a 6000x6000 image and placing smaller png's at specific locations and some of them being rotated, this all works fine. The problem is that the small images don't have their transparency preserved when some of the small image overlap. This is an example of what I mean. I have tried several -channel options and -alpha on but nothing seems to work. What am i missing here?

enter image description here

Here is the commands I am using for my test.

convert -size 6000x6000 xc:none ^
    ( Rectangle_01.png -repage +200+200 ) ^
    ( Rectangle_01.png -repage +651+200 -rotate 45 ) ^
    ( Rectangle_01.png -repage +1102+200 -rotate -45 ) -flatten -alpha on test.png
Was it helpful?

Solution 2

There is a similar topic on http://www.imagemagick.org

"Try:

-fuzz XX% -transparent white

where the smaller the %, the closer to true white or conversely, the larger the %, the more variation from white is allowed to become transparent."

http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=12619

OTHER TIPS

Did you try:

-background none

none is one of the built-in color names for a fully transparent color.

I found this question when trying to solve a similar problem with the montage command, that would not preserve transparency. Setting a transparent background did fix my problem. The default background in ImageMagick is white.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top