Skip to content

Remove unused PNG _OUTMODES#9780

Open
radarhere wants to merge 1 commit into
python-pillow:mainfrom
radarhere:png_outmodes
Open

Remove unused PNG _OUTMODES#9780
radarhere wants to merge 1 commit into
python-pillow:mainfrom
radarhere:png_outmodes

Conversation

@radarhere

Copy link
Copy Markdown
Member

_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;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"),
}

L;1, L;2, L;4, P;1, P;2 and P;4 are not valid Pillow modes. The P mode variants are created by

if mode == "P":

outmode += f";{bits}"

but the L mode variants are never used, and can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant