Sam Hocevar on wrote... | 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: | Yes I can now verify that I get proper checkerboard pattern.
Running latest IM release (with this patch and my (De)Polar updates against IM examples, for error checking... Yes it has removed all the horible top line problems I have been seeing. It has also improved the "alpha_dither_monochrome.gif" example, though it is still not right, leaving weird effect along the edge of the '-monochrome' of the extracted alpha channel linear gradient. IM Examples, Color Quantization and Dithering, http://www.imagemagick.org/Usage/quantize/#color_trans Test image.... convert xc:red xc:yellow xc:green1 xc:cyan xc:blue \ +append -filter Cubic -resize 100x100\! -size 100x100 \ gradient: +matte -compose CopyOpacity -composite alpha_gradient.png Monochrome the Alpha Channel to a boolean transparency... convert alpha_gradient.png -channel RGBA -separate \ \( +clone -monochrome \) +swap +delete \ -combine alpha_dither_monochrome.gif A copy of the resulting image is in http://www.cit.griffith.edu.au/~anthony/public/alpha_dither_monochrome.gif I would say this is some type of 'edge effect' problem. -------- At least this FS Disther is not randomized like the default FS dither implementation in NetPBM! When a dither 'selection' tool becomes available I can then re-write parts of the E-Dither section of IM Examples, Quantization. I also look forward to other types of dithers being added. You may like the 'FloydSteinbergDither()' library function to include a 'DitherOption' argument to differentiate between some of the different 'linear' E-Dithers. --------------------- ASIDE, as a FYI and future reference. You should avoid -geometry for image resizing, (it should only be used to SET image composition offsets). The -geometry option was badly stuffed around with in past versions of IM, and while it will do image resizes it is the only operator that is applied to just the last image in the current in-memory image sequence or list, rather that over the whole image list in some way, like every other IM operator does. The above should have been... convert xc:'gray(50%)' -resize 10000x10000 -size 1x2 -map gradient: x: or even a 'input image resize' using... convert xc:'gray(50%)[10000x10000]' -size 1x2 -map gradient: x: or better still convert -size 10000x10000 xc:'gray(50%)' -size 1x2 -map gradient: x: Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]> ----------------------------------------------------------------------------- And then you turn the corner, as the Dungeon Master chuckles... ----------------------------------------------------------------------------- Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/ _______________________________________________ Magick-developers mailing list Magick-developers@imagemagick.org http://studio.imagemagick.org/mailman/listinfo/magick-developers