Re: Importing GIF looses transparency (w/ConstituteImage)

Bob Friesenhahn <[email protected]> Wed, 14 Oct 2020 12:51:39 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
On Mon, 12 Oct 2020, Carl-Einar Thorner wrote:
>
> It seems to me that vips passes the correct parameters for the mapping, but
> I'm stumped on where to go from here.
>
> Is there a bug in GraphicsMagick or is VIPS calling ConstituteImage wrong?

I suspect that all that is needed is to set 'image->matte = MagickTrue';

A possible approach is to do 'image->matte = constitute_image->matte'.

You do need to pay attention to what might already be in the image 
opacity chanel when you enable matte since it appears that not all 
pixels may be over-written. By default, an image opacity channel is 
initialized to opaque(0).

The underlying implementation of CopyCompositeOp is 
CopyCompositePixels in magick/composite.c.  There you can see that a 
check is made on the 'matte' flags for both images.

Libvip's implementation of magick_import_pixels() does not appear to 
be very efficient since it is creating a temporary image.

If someone would submit a feature request to implement 
ImageMagick-compatible ImportImagePixels() in the GraphicsMagick 
tracker at SourceForge, then I might find time to implement it 
properly.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt