Skip to content

Use existing palette mode for C getpalette mode - #10216

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

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

Conversation

@radarhere

Copy link
Copy Markdown
Member

Currently, C's getpalette() accepts a mode and a rawmode. If the mode isn't provided, it defaults to RGB.

Pillow/src/_imaging.c

Lines 1312 to 1319 in c61e26c

char *mode_name = "RGB";
char *rawmode_name = NULL;
if (!PyArg_ParseTuple(args, "|ss", &mode_name, &rawmode_name)) {
return NULL;
}
if (rawmode_name == NULL) {
rawmode_name = mode_name;
}

However, C already knows what mode the palette is, and why would we ever want to pack the palette data from another mode?

So let's change getpalette() to only accept a rawmode, that defaults to the current palette mode.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant