Skip to content

Simplify point() mode default - #10513

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

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

Conversation

@radarhere

Copy link
Copy Markdown
Member

I find Image.point()'s mode parameter to be a bit odd. It is intended to default to the same mode as the image.

:param mode: Output mode (default is same as input). This can only be used if

So where does that default setting apply? Partly in _point_impl

Pillow/src/_imaging.c

Lines 1769 to 1776 in b8865b5

if (mode) {
bands = getbands(mode);
if (bands < 0) {
return NULL;
}
} else {
bands = self->image->bands;
}

and partly in ImagingPoint().
if (mode == IMAGING_MODE_UNKNOWN) {
mode = imIn->mode;
}

I think it would be simpler to set it in _point_impl, immediately after parsing the mode parameter.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant