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

Allow remap_palette() to return an image with less than 256 palette entries #6543

Merged
merged 1 commit into from Sep 21, 2022

Conversation

radarhere
Copy link
Member

In remap_palette(), there is the following code.

Pillow/src/PIL/Image.py

Lines 1947 to 1950 in ad7be55

# Internally, we require 256 palette entries.
new_palette_bytes = (
palette_bytes + ((256 * bands) - len(palette_bytes)) * b"\x00"
)

Testing prior versions of Pillow, I can't find a time when the tests failed without this code, but the fact that #6060 contained a commit entitled "Allow getpalette() to return less than 256 colors" indicates to me that this requirement has been removed.

@radarhere radarhere changed the title Removed requirement for 256 palette entries Allow remap_palette() to return an image with less than 256 palette entries Aug 29, 2022
@hugovk hugovk merged commit f73499e into python-pillow:main Sep 21, 2022
@radarhere radarhere deleted the remap_palette branch September 21, 2022 10:24
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.

None yet

2 participants