Skip Menu |

This queue is for tickets about the Imager CPAN distribution.

Report information
The Basics
Id: 68508
Status: resolved
Priority: 0/
Queue: Imager

People
Owner: Nobody in particular
Requestors: TONYC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.83
Fixed in: 0.84



Subject: error diffusion dither broken
Date: Fri, 27 May 2011 22:44:27 +1000
To: bug-Imager [...] rt.cpan.org
From: tonyc [...] cpan.org
Translating an image with the error diffusion dither doesn't appear to be handled correctly. perl -MImager -MImager::Test=test_image -e '$im = test_image(); $im->write(file => "mono.gif", make_colors => "mono", translate => "errdiff") or die $im->errstr' produces a mostly black image, but there should be some shading over the green/red/blue filled areas.
The problem is the error only accumulates on the red channel, and since the channel is capped at 255, the black entry continues to match for the entire image. As a partial solution we can process the image as grayscale when the supplied palette is grayscale. This isn't a perfect solution, since the caller can still provide a palette that doesn't cover the gamut used in the image, but it does handle a common case.
Note: the conversion to greyscale isn't done for the other colour translators since they do no error propagation, so the current algorithm is enough.
Fixed about as well as it can be in 0.84.