Page 1 of 1

-flatten causes gamma-shift

Posted: 2014-12-14T09:52:54-07:00
by snibgo
A new bug was introduced sometime between 6.8.9-5 and 6.9.0-0. (Windows 8.1, Q16 binary distribution.)

For greyscale inputs, "-flatten" causes a shift in the gamma value, from 1/2.2 to 1.

Test case:

Code: Select all

convert -size 1x1 xc:#888 f0.png

convert f0.png -background Red -flatten f0_out.png

identify -format "f0.png gamma = %%[gamma]\n" f0.png

identify -format "f0_out.png gamma = %%[gamma]\n" f0_out.png
Results:

Code: Select all

f0.png gamma = 0.45455
f0_out.png gamma = 1
"-layers flatten" shows the same problem.

The problem occurs only when the input contains no colour. If the input contains transparency, so the flatten introduces colour, the gamma is shifted to 1.

Re: -flatten causes gamma-shift

Posted: 2014-12-14T10:49:36-07:00
by magick
6.9.0-1 Beta has this ChangeLog entry:
  • 2014-11-20 6.9.0-1 Glenn Randers-Pehrson <glennrp@image...>
    * Don't override gamma with 1.0 when reading a grayscale PNG image (reference
    viewtopic.php?f=3&t=26576).

Re: -flatten causes gamma-shift

Posted: 2014-12-14T10:56:55-07:00
by snibgo
Ah, yes, it's probably the same bug, so is probably now fixed. Thanks.