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

plt.imshow() error on PIL-opened tiff images #12140

Closed
anntzer opened this issue Sep 17, 2018 · 1 comment · Fixed by #13405
Closed

plt.imshow() error on PIL-opened tiff images #12140

anntzer opened this issue Sep 17, 2018 · 1 comment · Fixed by #13405

Comments

@anntzer
Copy link
Contributor

anntzer commented Sep 17, 2018

plt.imshow(PIL.Image.open("lib/matplotlib/tests/baseline_images/test_image/uint16.tif"))

fails with

<elided>
  File "/home/antony/src/extern/matplotlib/lib/matplotlib/image.py", line 838, in make_image
    unsampled=unsampled)
  File "/home/antony/src/extern/matplotlib/lib/matplotlib/image.py", line 447, in _make_image
    if A.mask.shape == A.shape:
AttributeError: 'numpy.ndarray' object has no attribute 'mask'

since 12c27f3 (mpl 2.1 @tacaswell); previously it was possible to directly plot PIL-opened images (which do follow the standard buffer protocol).

It is not particularly problematic because one can just wrap explicitly the PIL-opened image using np.asarray, or use plt.imread instead (which does exactly that); still, I'm raising the issue here in case we want to fix it. (Or documenting that we no longer support PIL images is fine too, again the workaround is not that bad.)

@tacaswell tacaswell added this to the v2.2.4 milestone Sep 17, 2018
@tacaswell
Copy link
Member

that interpolation refactor is the bug that just keeps giving....

@tacaswell tacaswell modified the milestones: v2.2.4, v2.2.5 Feb 11, 2019
@QuLogic QuLogic modified the milestones: v2.2.5, v2.2.4 Feb 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants