-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Palette order affects output #9
Comments
Note: the correct image is |
Here is the most minimal test case I could find. Original image, a 2x2 PNG of only the color Direct link: https://user-images.githubusercontent.com/25111343/117172919-42aaf100-ad9a-11eb-8410-f56eba406f58.png Here are the two outputs, scaled up with |
This test can actually be replicated by the dither library. Transferring issue there now. |
Ok, I have figured out the problem. When quantization error is applied to the bottom right pixel, the final (linear, 16-bit) value is The Euclidean distance (without square root) of white (16-bit) to the yellow is The nearest color is evaluated in a loop, and a "best" value is compared against, with only lower distances being let through. Since red and white distances are equal, whether red or white is specified first in the palette will determine which wins out. What is the solution to this? Having palette order affect output is problematic and unexpected for users. But ultimately this appears to be subjective! In @Shrinks99's example Mathematically they are equivalent, but not to the human eye. And the preferred image seems to be context dependent, like it's nicer for the parrot's feathers to all match, while it's nicer for game on the table to look different than the background. Telling users to switch around palette order if things look bad is not really feasible. For larger palettes this becomes an annoying problem requiring a script, and in most cases it won't affect anything at all and would just be a pointless worry. Is there any solution possible, or is this just inherent to dithering? |
Using |
@KelSolaar sorry to bother you but I was wondering if you had any input on this. |
If a checkerboard is what is desired here, then it is all the second images that are correct, the palette of |
This issue has been fixed in the |
Branch was merged in #12 |
This issue was originally made for the didder repo, so didder commands are referenced.
This is a strange and important bug.
These are the two commands:
input.png
is this image:Here are the respective outputs:
Obviously, they should be exactly the same. This only occurs with
edm
and does not depend on the matrix used. This does not seem to occur with the upstream dither library, indicating the problem is with the didder code.The text was updated successfully, but these errors were encountered: