You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a PNG image with mode P and a custom transparency value, opacity information is lost when you convert to HEIC.
Steps/Code to Reproduce
fromPILimportImage, ImageDrawfrompillow_heifimportregister_heif_openerregister_heif_opener()
# Draw a basic checkerboard imageim=Image.new("P", size=(100, 100))
draw=ImageDraw.Draw(im)
draw.rectangle(xy=[(0, 0), (50, 50)], fill=255)
draw.rectangle(xy=[(50, 50), (100, 100)], fill=255)
# Save the image as a PNG, marking the 0'th colour in the palette as transparentim.save("checkerboard.png", transparency=0)
# Open the image, then save it as an AVIFopened_im=Image.open("checkerboard.png")
opened_im.save("checkerboard.heic", transparency=0)
Expected Results
An image with a simple 2×2 checkerboard pattern, with transparent squares in the bottom left and top right.
Actual Results
The HEIC is rendered as a solid black image, losing the transparency from the PNG.
Describe the bug
If you have a PNG image with mode
P
and a customtransparency
value, opacity information is lost when you convert to HEIC.Steps/Code to Reproduce
Expected Results
An image with a simple 2×2 checkerboard pattern, with transparent squares in the bottom left and top right.
Actual Results
The HEIC is rendered as a solid black image, losing the transparency from the PNG.
Versions
The text was updated successfully, but these errors were encountered: