[magick-developers] about ImageMagick's dithering on a Hilbert-Peano curve
Sam Hocevar
sam at zoy.org
Wed Aug 13 12:38:14 PDT 2008
On Tue, Aug 12, 2008, Anthony Thyssen wrote:
> | Second, I mistakenly assumed that AcquireQuantumMemory would
> | zero the memory, which it apparently doesn't do. The following code
> | is therefore required after the AcquireQuantumMemory() call in
> | FloydSteinbergDither():
> |
> | memset(scanlines, 0, 2*sizeof(*scanlines) * image->columns);
> |
> It looks like Crisy has added this to your replacement...
>
> ResetMagickMemory(scanlines,0,2*sizeof(*scanlines));
>
> No indication of any move to give an argument to the rarely use option,
> "-dither" so that BOTH forms of dither can be used.
>
> | Third, and I am afraid you are never going to see a perfect
> | checkerboard until this is dealt with, the IM RealPixelPacket values for
> | a 50% gray pixel are 32639 instead of 32767. Not sure where to fix that.
> |
> Ues I reported this before.
Okay, I don't know what I was smoking, but the original patch was
actually quite messed up. There is in fact no reason to zero the memory,
because no uninitialised values are addressed, except that this was
buggy in my first contribution. Here is a patch against current SVN that
fixes it completely. You now get a perfect checkerboard as expected, and
no uninitialised memory accesses hence no need for ResetMagickMemory:
http://zoy.org/~sam/patches/patch-imagemagick-floyd-steinberg-fixes.diff
Tested with the following commands (lots of RAM needed):
convert xc:'gray(50%)' -geometry '10000x10000!' -size 1x2 -map gradient: x:
convert xc:'gray(50%)' -geometry '10001x10001!' -size 1x2 -map gradient: x:
Cheers,
--
Sam.
More information about the Magick-developers
mailing list