Re: flattening: two ways, two different results
frechefuchs via Graphicsmagick-help <[email protected]> Thu, 31 Aug 2023 19:20:05 +0200
| Newsgroups | gmane.comp.video.graphicsmagick.help |
|---|---|
| Message-ID | <[email protected]> |
Am 31.08.23 um 15:17 schrieb Bob Friesenhahn: > On Thu, 31 Aug 2023, frechefuchs via Graphicsmagick-help wrote: >> >>> gm convert logo: PNG32:- | gm convert - -operator matte assign 50% -verbose info:- >>> /tmp/gmx7zyAz PNG 654x418+0+0 DirectClass 8-bit 52.2Ki 0.010u 0m:0.046921s (5.6Mi pixels/s) >>> Image: /tmp/gmx7zyAz >>> Format: PNG (Portable Network Graphics) >>> Geometry: 654x418 >>> Class: DirectClass >>> Type: true color with transparency >>> Depth: 9 bits-per-pixel component <== here >>> Channel Depths: >>> Red: 8 bits >>> Green: 8 bits >>> Blue: 8 bits >>> Opacity: 9 bits <== here >> >> Shouldn't that be 8 bits? > > A Q16 build could produce a number which does not fit perfectly in 8 > bits. 32768 does not scale down perfectly to 8 bits. That said, I > have suspected for a while that my depth estimation algorithm needs > improvement. Ah, makes sense! What I thought was that the 1 bit transparency from the 'logo: PNG32:-' output somehow got mixed up with the new full 8 bit transparency channel depth during conversion. Changing the argument to 'assign' to different values I can now see random transparency channel bit depths. Sorry for the noise! > If you are going to pipe PNG to PNG then using this syntax will likely > help. At least with modern GM, it avoids using a temporary file: > > gm convert logo: PNG32:- | gm convert PNG:- -operator ... Nice. Though, thanks to the -type TrueColorMatte option, in my use-case I don't need to pipe PNG to PNG any more. The 'logo: PNG24:-' was just used here to simulate my original 24 bit PNG input to GM. But while we're at it, while converting logo: to PNG24: and PNG32: works, the conversion fails for PNG48: (and PNG64:). > gm convert logo: PNG48:- | gm convert - info:- > gm convert: No encode delegate for this image format (PNG48) [No such file or directory]. > gm convert: Unable to open file (/tmp/gmI3cJGb) [No such file or directory]. Is that to be expected once again? Thanks! fux > gm version > GraphicsMagick 1.3.35 2020-02-23 Q16 http://www.GraphicsMagick.org/