Open missionfloyd opened 3 years ago
Interesting. How did you create the PIL image? If PIL works better, then I would suggest using that.
from PIL import Image
img = Image.open('808080.png') # solid grey image
img_dithered = img.convert('1') # uses floyd-steinberg dithering by default
img_dithered.save('dithered.png')
PIL only supports Floyd-Steinberg, however.
I've noticed that images produced with hitherdither are slightly different than those produced with other programs using the same algorithms.
I tested this using Floyd-Steinberg on a solid 50% gray image, which should produce a uniform checkerboard pattern.
I've found that by rounding when distributing the quantization error, the above image renders correctly, while others are closer but still different.
ni[yn, xn] += np.round(quantization_error * diffusion_coefficient)
Maybe that's as good as it's gonna get.