Pillow icon indicating copy to clipboard operation
Pillow copied to clipboard

Restored __array__ for libraries that do not support __array_interface__

Open radarhere opened this issue 3 years ago • 0 comments

Resolves #6422

The issue has discovered that tensorflow supports converting Pillow images using __array__, but not __array_interface__. One solution would be to say that tensorflow should support __array_interface__, and an issue has been opened for that - https://github.com/tensorflow/tensorflow/issues/56723

This PR is an alternative, where we add __array__, to provide support from our end. Conceivably, there may be other libraries that support __array__, but not __array_interface__. Testing, I find that NumPy prefers __array_interface__ over __array__, so this should not affect NumPy use.

radarhere avatar Aug 10 '22 11:08 radarhere