Subject: | autolevels_mono doesn't level a 2 level image to B&W |
Date: | Mon, 8 Feb 2016 19:37:27 +1100 |
To: | bug-Imager [...] rt.cpan.org |
From: | Tony Cook <tony [...] develop-help.com> |
autolevels_mono has two problems here:
- the scale value is an integer for 8-bit images, and so if the range
between min_lum and max_lum doesn't divide evenly into 255 the
"white" level isn't white
- there's an off-by-one error calculating min_lum and max_lum, so even
if scale is floating point the "black" and "white" source levels are
converted to just above black and white.
As an optimization, the 8-bit code should use a look-up table.