flattening: two ways, two different results
frechefuchs via Graphicsmagick-help <[email protected]> Wed, 30 Aug 2023 18:36:51 +0200
| Newsgroups | gmane.comp.video.graphicsmagick.help |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I've observed that I get slightly different results when flattening a
file in two different ways, while I'd expect the result to be the same.
In the end, I'm fine with either result, but I'd be more comfortable
knowing what's going on behind the scenes.
I have an 8 bit per channel true colour image that I'd like to fade out.
My idea was to add a matte channel with a high transparency and finally
flatten the 32 bits per channel image back to 24 bits per channel. This
works.
gm convert LOGO: -operator matte assign 95% PNG32:- \
| gm convert - -flatten PNG24:out-1.png
(Aside: Merging both lines into one command results in a non-faded image
as if the flattening operator didn't notice the matte channel. Why is
that?)
Now, if I put the -operator option into the second gm invocation like in
gm convert LOGO: PNG32:- \
| gm convert - -operator matte assign 95% -flatten PNG24:out-2.png
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?
Thanks!
fux