Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Use mode as default for C getpalette raw mode#9822

Open
radarhere wants to merge 1 commit into
python-pillow:mainpython-pillow/Pillow:mainfrom
radarhere:getpaletteradarhere/Pillow:getpaletteCopy head branch name to clipboard
Open

Use mode as default for C getpalette raw mode#9822
radarhere wants to merge 1 commit into
python-pillow:mainpython-pillow/Pillow:mainfrom
radarhere:getpaletteradarhere/Pillow:getpaletteCopy head branch name to clipboard

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.