Skip to content

Fixed a mistake in Atkinson dithering method#1489

Merged
cameronwhite merged 6 commits into
PintaProject:masterfrom
Lehonti:improvement3
May 25, 2025
Merged

Fixed a mistake in Atkinson dithering method#1489
cameronwhite merged 6 commits into
PintaProject:masterfrom
Lehonti:improvement3

Conversation

@Lehonti

@Lehonti Lehonti commented May 24, 2025

Copy link
Copy Markdown
Contributor

When I first read the article (https://tannerhelland.com/2012/12/28/dithering-eleven-algorithms-source-code.html) from which I drew the implementation of the dithering effect (#457), I didn't notice that the Atkinson method involves a 'reduced color bleed'. That is, one does not divide by the sum of the elements of the matrix, but by something larger.

@Lehonti

Lehonti commented May 24, 2025

Copy link
Copy Markdown
Contributor Author

I was tired when I wrote the code on commit fe93db3, so I made a mistake and the test failed, but if the factor is changed to 0.125 it should succeed. Wheter we take all commits or discard the last one is a matter of whether we want a divider or a factor

@cameronwhite

Copy link
Copy Markdown
Member

Having it as a factor seems better to me, especially if TotalWeight is no longer the actual total weight :)

@Lehonti

Lehonti commented May 24, 2025

Copy link
Copy Markdown
Contributor Author

Great @cameronwhite . It is a factor now, and I'm expressing the constant value in a way that makes the reasoning clearer :)

@cameronwhite cameronwhite merged commit ef75386 into PintaProject:master May 25, 2025
6 checks passed
@Lehonti Lehonti deleted the improvement3 branch May 25, 2025 15:48
@cameronwhite cameronwhite added this to the 3.0.3 milestone Jul 18, 2025
cameronwhite pushed a commit that referenced this pull request Jul 31, 2025
* Changed name of `TotalWeight` and made it a factor, not a divider

(cherry picked from commit ef75386)
@cameronwhite cameronwhite mentioned this pull request Jul 31, 2025
3 tasks
cameronwhite pushed a commit that referenced this pull request Aug 1, 2025
* Changed name of `TotalWeight` and made it a factor, not a divider

(cherry picked from commit ef75386)
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

Successfully merging this pull request may close these issues.

2 participants