Skip to content

Conversation

@radarhere
Copy link
Member

Resolves #8081

The issue points out that _write_multiple_frames converts images to rawmode

im_frame = im_frame.convert(rawmode)

where rawmode is
rawmode, bit_depth, color_type = _OUTMODES[mode]

_OUTMODES = {
# supported PIL modes, and corresponding rawmode, bit depth and color type
"1": ("1", b"\x01", b"\x00"),
"L;1": ("L;1", b"\x01", b"\x00"),
"L;2": ("L;2", b"\x02", b"\x00"),
"L;4": ("L;4", b"\x04", b"\x00"),
"L": ("L", b"\x08", b"\x00"),
"LA": ("LA", b"\x08", b"\x04"),
"I": ("I;16B", b"\x10", b"\x00"),
"I;16": ("I;16B", b"\x10", b"\x00"),
"I;16B": ("I;16B", b"\x10", b"\x00"),
"P;1": ("P;1", b"\x01", b"\x03"),
"P;2": ("P;2", b"\x02", b"\x03"),
"P;4": ("P;4", b"\x04", b"\x03"),
"P": ("P", b"\x08", b"\x03"),
"RGB": ("RGB", b"\x08", b"\x02"),
"RGBA": ("RGBA", b"\x08", b"\x06"),
}

and so may not always be a Pillow image mode.

@hugovk hugovk merged commit 48a921b into python-pillow:main Jun 25, 2024
@radarhere radarhere deleted the png_save_all branch June 25, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Saving all frames of a paletted PNG with few colors can fail

2 participants