Pillow
Pillow copied to clipboard
Restored __array__ for libraries that do not support __array_interface__
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.