-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add primary color dithering to ImageOps #9339
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
base: main
Are you sure you want to change the base?
Add primary color dithering to ImageOps #9339
Conversation
for more information, see https://pre-commit.ci
Co-authored-by: Andrew Murray <[email protected]>
Co-authored-by: Andrew Murray <[email protected]>
Co-authored-by: Andrew Murray <[email protected]>
|
I've created Marcelo-MConti#1 to fix the lint failures. |
thanks for fix the lint failures
|
I've created Marcelo-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. |
|
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 |
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? Why value > 233, why quadrant in (0, 3), etc.?
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