Skip to content

Use mode as default for C getpalette raw mode#9822

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

Use mode as default for C getpalette raw mode#9822
radarhere wants to merge 1 commit into
python-pillow:mainfrom
radarhere:getpalette

Conversation

@radarhere

Copy link
Copy Markdown
Member

In C's getpalette(), the default for the raw mode argument is "RGB"

Pillow/src/_imaging.c

Lines 1185 to 1193 in 9e282f5

_getpalette(ImagingObject *self, PyObject *args) {
PyObject *palette;
int palettesize;
int bits;
ImagingShuffler pack;
char *mode_name = "RGB";
char *rawmode_name = "RGB";
if (!PyArg_ParseTuple(args, "|ss", &mode_name, &rawmode_name)) {

However, I don't find this default is used anywhere. Instead, I've found four calls like

palette_data = im.im.getpalette(mode, mode)[: colors * len(mode)]

I think it makes more sense to use the mode as the default for the raw mode.

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