matthewwithanm / pilkit

Utilities and processors built for, and on top of PIL
BSD 3-Clause "New" or "Revised" License
196 stars 54 forks source link

Transparency Loss in Palletized PNG Files - Regression in Version 3.0 #72

Closed pix666 closed 6 months ago

pix666 commented 11 months ago

Hello!

In version 3.0, there is a regression issue related to the loss of transparency in palette-based PNG files.

input.png

from PIL import Image
from pilkit.processors.utils import resolve_palette

img = Image.open('input.png')
new_img = resolve_palette(img)
new_img.save('output.png')

As a result of executing the provided code, the output image will lose its transparency and appear on a white background.

The root cause of the error is that, despite the image having transparency, the image.palette.mode property is equal to RGB.

Related commit

vstoykov commented 7 months ago

Hello @pix666, the regression you mentioned is caused by the fix of #44. Because I don't have so much free time (consider my late reply), can you try to think/test a solution that will work for your case and to still address the mentioned issue?

vstoykov commented 6 months ago

I will try to release new version in the coming days. Thank you again for your time.