Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.4k
Comments
Add primary color dithering to ImageOps#9339
Open
Marcelo-MConti wants to merge 11 commits intopython-pillow:mainfrom
Open
Add primary color dithering to ImageOps#9339Marcelo-MConti wants to merge 11 commits intopython-pillow:mainfrom
Marcelo-MConti wants to merge 11 commits intopython-pillow:mainfrom
Conversation
for more information, seehttps://pre-commit.ci
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Member
radarhere commentedDec 14, 2025
I've createdMarcelo-MConti#1 to fix the lint failures. |
thanks for fix the lint failures
Member
radarhere commentedDec 15, 2025
I've createdMarcelo-MConti#2 with an idea - process the image by band, instead of all bands at once. I find it is a bit faster, and neater. |
Author
Marcelo-MConti commentedDec 18, 2025 • edited by radarhere
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by radarhere
Uh oh!
There was an error while loading.Please reload this page.
Thanks so much for your help! |
| return 255 if quadrant in (0, 3) else 0 | ||
| if value > 32: | ||
| return 255 if quadrant == 1 else 0 | ||
| return 0 |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Did you want to explain a bit where this logic comes from? Whyvalue > 233, whyquadrant in (0, 3), etc.?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds a new image operation to
PIL.ImageOpsthat applies aprimary-color dithering filter (RGB only).
The filter:
Why is this useful?
Primary-color dithering can be useful for:
What is included?
ImageOps.dither_primaryNotes
Before Filter
After Filter