Use current frame for transparency detection

This commit is contained in:
Aleksandr Karpinskii 2024-09-16 11:04:00 +02:00
parent d1f40a94ff
commit 31d36e6b70
2 changed files with 4 additions and 2 deletions

View File

@ -243,7 +243,9 @@ def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
# Make sure image mode is supported
frame = ims
if frame.mode not in ("RGBX", "RGBA", "RGB"):
frame = frame.convert("RGBA" if im.has_transparency_data else "RGB")
frame = frame.convert(
"RGBA" if frame.has_transparency_data else "RGB"
)
# Append the frame to the animation encoder
enc.add(