Atkinson dither algorithm & 'for each' loop

hh hh at hyperhh.de
Thu Oct 12 15:07:59 EDT 2017


> Al wrote:
> Please, check this new handler in the forum and suggest how to
> make this faster and more precise.

I already gave you a method that is, with a 500x500 image, at
least 1000 (thousand) times faster than your script.

Of course this is not due my special skills but the ability of
javascript (used via a browser widget) to let the GPU/graphic
card do the essential job of pixel manipulation.

So all considerations to improve the LCS script are, TMHO, of
rather theoretical value. Here are some more:

> Al wrote:
> ... the result STILL is not visually identical to that handler.
> My educated guess is that Atkinson dither algorithm requires
> numbers with more than 2 numbers after the decimal point.
> That is: 243.643578 instead of just 243.64

Conclude from the following:
The Atkinson algorithm uses multiples of 1/8 = 0.125 for the
diffusion-error, the Floyd-Steinberg algorithm uses multiples
of 1/16 = 0.0625. 

And have this in mind:
Whenever you use numToChar(Number) in your script you are wrong by
Number - round(Number) of the accumulated pixel value ...




More information about the Use-livecode mailing list