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

Only import numpy when necessary #5323

Merged
merged 1 commit into from Mar 28, 2021
Merged

Conversation

@radarhere
Copy link
Member

@radarhere radarhere commented Mar 11, 2021

Resolves #5320

Moves ImageFilter numpy import into the ImageFilter.Color3DLUT constructor, so that numpy is not imported only to be unused.

@basilgello
Copy link

@basilgello basilgello commented Mar 11, 2021

And still adding an optional parameter to Color3DLut constructor disabling numpy usage might be perfect solution for those who want to stop using numpy within Pillow (for example if a buggy version installed in the system is out of their control).

@radarhere
Copy link
Member Author

@radarhere radarhere commented Mar 11, 2021

But that wouldn't help your situation, because you're not the one calling Color3DLUT, right?

@basilgello
Copy link

@basilgello basilgello commented Mar 11, 2021

@radarhere radarhere force-pushed the imagefilter_numpy branch from 346b4f2 to 188d4f6 Mar 12, 2021
@radarhere
Copy link
Member Author

@radarhere radarhere commented Mar 12, 2021

I'm not sold on the idea that Pillow should be adding workarounds for uncommon numpy bugs.

That said, I am willing to accept that from an efficiency standpoint, it could be better for Pillow not to import numpy if it isn't actually going to be used.

I've updated this PR, so that it now does a rudimentary check to see if table is a numpy object. This creates a clear path for Pillow users to not import numpy in ImageFilter - just don't pass a numpy object to Color3DLut.

@basilgello
Copy link

@basilgello basilgello commented Mar 12, 2021

@hugovk
Copy link
Member

@hugovk hugovk commented Mar 28, 2021

@basilgello Hi! Have you checked this PR yet? If it's good we can include it in Thursday's release. Thanks!

@basilgello
Copy link

@basilgello basilgello commented Mar 28, 2021

@hugovk hugovk merged commit b3a1de9 into python-pillow:master Mar 28, 2021
49 of 50 checks passed
@radarhere radarhere deleted the imagefilter_numpy branch Mar 28, 2021
@cgcgcgcgcg
Copy link

@cgcgcgcgcg cgcgcgcgcg commented Apr 25, 2021

The python-pillow update on 2021-04-23 fixed my issue with Kodi 19, but one day later python-numpy was updated and crashes started again.
So I'm back to using Flatpak Kodi until this is sorted.

@radarhere
Copy link
Member Author

@radarhere radarhere commented Apr 25, 2021

Let us know if you feel there is anything for us to do - but from discussion in #5320, I would think we've now done all we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants