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

Improved palette handling in ImageOps #1

Merged
merged 3 commits into from Sep 19, 2022

Conversation

radarhere
Copy link

Three suggestions here for python-pillow#6596

  1. You may have noticed that the tests are failing your pull request, with the error AttributeError: 'NoneType' object has no attribute 'copy'. This is because not all images have a palette. The palette doesn't actually need to be duplicated though, so I've removed the copy() operation.
  2. I've added a test, to help prevent your change from being unintentionally broken in the future. After writing the test, I found that it was necessary to use getpalette(), and that ImageOps.expand() could also benefit from this change.
  3. I notice that your code doesn't explicitly check the mode, allowing the palette data to be copied for both P and PA images. This is a good idea, and I've made that change for ImageOps.expand() as well.

@PososikTeam PososikTeam merged commit 597dff7 into PososikTeam:fix-padding Sep 19, 2022
radarhere pushed a commit that referenced this pull request Sep 21, 2022
…in-finding-new-size

Round position in pad()
@radarhere radarhere deleted the fix-padding branch September 21, 2022 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants