Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added direct conversion from PA to P #6509

Merged
merged 1 commit into from
Aug 17, 2022
Merged

Conversation

radarhere
Copy link
Member

#6506 asked how Pillow converted images from PA to P.

The answer was because PA to P conversion doesn't exist, Pillow instead falls back to converting from PA to RGB, and then RGB to P.

This PR adds direct conversion from PA to P. There should be no functional change, only an increase in efficiency.

@@ -1209,6 +1217,8 @@ frompalette(Imaging imOut, Imaging imIn, const char *mode) {
convert = alpha ? pa2l : p2l;
} else if (strcmp(mode, "LA") == 0) {
convert = alpha ? pa2la : p2la;
} else if (strcmp(mode, "P") == 0) {
convert = pa2p;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange that Codecov doesn't think this is tested - when I run the test suite on my local machine, it is tested by test_image_convert.py's test_sanity.

@hugovk hugovk merged commit d80e93e into python-pillow:main Aug 17, 2022
@radarhere radarhere deleted the pa2p branch August 17, 2022 07:01
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.

2 participants