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 ImageOps palette handling #6596

Merged
merged 7 commits into from
Sep 26, 2022

Conversation

PososikTeam
Copy link
Contributor

@PososikTeam PososikTeam commented Sep 18, 2022

Resolves #6595

This pull request fix ImageOps.pad method. In previous version of this method it doesn't copy the palette, and whats why it might change the image to full black image.

Changes proposed in this pull request:

  • Add copy origin image palette to pad image.

Improved palette handling in ImageOps
@radarhere radarhere changed the title Put palette into the new pad image Improved palette handling in ImageOps Sep 19, 2022
@radarhere
Copy link
Member

PososikTeam#1 has been merged, containing suggestions from me

  • Removing the copy() operation, as it is not necessary, and not all images have palettes
  • Switched to using getpalette() in both pad() and expand(), allowing the test I added to pass
  • Stop expand() from only copying the palette for P images, allowing for the PA mode as well

@radarhere radarhere merged commit 3fd6a1e into python-pillow:main Sep 26, 2022
@radarhere radarhere changed the title Improved palette handling in ImageOps Improved ImageOps palette handling Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Method ImageOps.pad doesn't copy palette of original image
2 participants