Skip to content

Improved palette handling in ImageOps#1

Merged
PososikTeam merged 3 commits intoPososikTeam:fix-paddingfrom
radarhere:fix-padding
Sep 19, 2022
Merged

Improved palette handling in ImageOps#1
PososikTeam merged 3 commits intoPososikTeam:fix-paddingfrom
radarhere:fix-padding

Conversation

@radarhere
Copy link
Copy Markdown

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

Development

Successfully merging this pull request may close these issues.

2 participants