Conversation
… color for background or transparency
|
I've pushed another commit to not use Lines 1012 to 1019 in 52856bc is currently always going to raise a ValueError. Pillow/src/PIL/ImagePalette.py Lines 142 to 144 in 52856bc Pillow/src/PIL/ImagePalette.py Lines 90 to 96 in 52856bc This fixes the UserWarning in #2803 |
| assert im.getpixel((0, 0)) == (0, 255, 0, 255) | ||
| assert im.getpixel((64, 32)) == (0, 255, 0, 255) | ||
| assert im.getpixel((0, 0)) == (255, 0, 0, 0) | ||
| assert im.getpixel((64, 32)) == (255, 0, 0, 0) |
There was a problem hiding this comment.
Using https://pypi.org/project/apng/ to split Tests/images/apng/mode_palette_alpha.png into frames, this matches the transparent third frame
| im_cropped = im_expanded.crop( | ||
| (10, 10, im_expanded.width - 10, im_expanded.height - 10) | ||
| ) | ||
| assert_image_equal(im_cropped, im) |
|
I've now pushed a commit, 'Fixed reloading palette'. It allows this code to work. from PIL import Image
im = Image.open("Tests/images/hopper.gif")
im.load()
im.palette.dirty = 1
im.save("out.png")In master at the moment, it produces this broken output. And with the addition of that change, this PR now resolves #2803 |

This PR has several changes
colorsdictionary is currently empty when the object is created, rather than being filled with palette entries. This fixes thatEdit: Thanks to later commits, resolves #2803