Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect output #10

Open
missionfloyd opened this issue May 22, 2021 · 2 comments
Open

Incorrect output #10

missionfloyd opened this issue May 22, 2021 · 2 comments

Comments

@missionfloyd
Copy link

missionfloyd commented May 22, 2021

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.

Input Output Expected (from PIL)
808080 out mock_output

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.

@hbldh
Copy link
Owner

hbldh commented Jun 28, 2021

Interesting. How did you create the PIL image? If PIL works better, then I would suggest using that.

@missionfloyd
Copy link
Author

missionfloyd commented Jul 27, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants