Last active
July 8, 2021 06:41
-
-
Save benjaminrigaud/d98a4b54fb409bc8f745d169df0196fc to your computer and use it in GitHub Desktop.
Pillow 8.3.0 regression on convert on P images with transparency
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pillow==8.3.1 | |
pytest==6.2.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from io import BytesIO | |
from PIL import Image | |
def test_convert_p(): | |
with open("indexed_with_transparency.png", "rb") as f: | |
data = BytesIO(f.read()) | |
img = Image.open(data) | |
assert img.mode == "P" | |
assert img.palette.mode == "RGB" | |
assert img.info.get("transparency") == 0 | |
img2 = img.convert() | |
assert img2.mode == "RGBA" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment