Skip to content

Instantly share code, notes, and snippets.

@benjaminrigaud
Last active July 8, 2021 06:41
Show Gist options
  • Save benjaminrigaud/d98a4b54fb409bc8f745d169df0196fc to your computer and use it in GitHub Desktop.
Save benjaminrigaud/d98a4b54fb409bc8f745d169df0196fc to your computer and use it in GitHub Desktop.
Pillow 8.3.0 regression on convert on P images with transparency
Pillow==8.3.1
pytest==6.2.4
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