Re: flattening: two ways, two different results

Bob Friesenhahn <[email protected]> Wed, 30 Aug 2023 14:30:09 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
On Wed, 30 Aug 2023, frechefuchs via Graphicsmagick-help wrote:
>
> the result is slightly different (checked per file size, the gm compare
> command as well as gm identify).  Yet, I'd expect the image data to be
> identical before the flattening operation.  Can anybody please shed some
> light on why both commands give different results?

The image returned by "LOGO:" is a colormapped GIF image, without any 
transparency.  GIF is only capable of a single transparent 'color' 
which acts like a mask.  Regardless, the '-operator matte assign' 
operation will not serve any purpose with it since it is desiged for 
RGBA TrueColor images and the implementation does not automatically 
promote a colormapped image to directclass.

It may be that

   gm convert logo: -type TrueColorMatte

will provide something closer to what is wanted.

As a verification that it did something:

% gm convert logo: info:-
  GIF 654x418+0+0 PseudoClass 128c 8-bit 0.000u 0m:0.001665s (156.6Mi pixels/s)

% gm convert logo: -type TrueColorMatte info:-
  GIF 654x418+0+0 DirectClass 8-bit 0.010u 0m:0.003839s (67.9Mi pixels/s)

% gm convert logo: -type TrueColorMatte -operator matte assign 50% info:-
  GIF 654x418+0+0 DirectClass 8-bit 0.000u 0m:0.001577s (165.3Mi pixels/s

or do this to see info about the Opacity channel:

% gm convert logo: -type TrueColorMatte -operator matte assign 50% -verbose info:-

and if using powerful Ubuntu 20.04 (as I am at this instant), you 
could see it in a X11 window like this:

gm convert logo: -type TrueColorMatte -operator matte assign 50% x:

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