Title: plt.imshow() error on PIL-opened tiff images · Issue #12140 · matplotlib/matplotlib · GitHub
Open Graph Title: plt.imshow() error on PIL-opened tiff images · Issue #12140 · matplotlib/matplotlib
X Title: plt.imshow() error on PIL-opened tiff images · Issue #12140 · matplotlib/matplotlib
Description: plt.imshow(PIL.Image.open("lib/matplotlib/tests/baseline_images/test_image/uint16.tif")) fails with
Open Graph Description: plt.imshow(PIL.Image.open("lib/matplotlib/tests/baseline_images/test_image/uint16.tif")) fails with
X Description: 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&qu...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/12140
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"plt.imshow() error on PIL-opened tiff images","articleBody":"```\r\nplt.imshow(PIL.Image.open(\"lib/matplotlib/tests/baseline_images/test_image/uint16.tif\"))\r\n```\r\nfails with\r\n```\r\n\u003celided\u003e\r\n File \"/home/antony/src/extern/matplotlib/lib/matplotlib/image.py\", line 838, in make_image\r\n unsampled=unsampled)\r\n File \"/home/antony/src/extern/matplotlib/lib/matplotlib/image.py\", line 447, in _make_image\r\n if A.mask.shape == A.shape:\r\nAttributeError: 'numpy.ndarray' object has no attribute 'mask'\r\n```\r\nsince https://github.com/matplotlib/matplotlib/pull/8966/commits/12c27f3892931f0f3113e3041bed38d195b1d40d (mpl 2.1 @tacaswell); previously it was possible to directly plot PIL-opened images (which do follow the standard buffer protocol).\r\n\r\nIt 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.)","author":{"url":"https://github.com/anntzer","@type":"Person","name":"anntzer"},"datePublished":"2018-09-17T13:32:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/12140/matplotlib/issues/12140"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c2e87402-73af-2a34-c8f9-705691ee32d2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C368:2BA72B:2F5513:4155F8:6A584727 |
| html-safe-nonce | 6db5647883d815cc097de54cd50871ea48d76c1f0f366de358587fe783d08c77 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzY4OjJCQTcyQjoyRjU1MTM6NDE1NUY4OjZBNTg0NzI3IiwidmlzaXRvcl9pZCI6IjM0MzA4OTQzNDM5NzE5NDgzMjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8dfbe9f22f5d894d2aff72aed013e26a5846125f14131ce2811389fc59d654c4 |
| hovercard-subject-tag | issue:360871291 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/12140/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c2fde0498eb434d84a344cf4015e650fc92bf7dfe93656e3e3d3e6040852142f/matplotlib/matplotlib/issues/12140 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c2fde0498eb434d84a344cf4015e650fc92bf7dfe93656e3e3d3e6040852142f/matplotlib/matplotlib/issues/12140 |
| og:image:alt | plt.imshow(PIL.Image.open("lib/matplotlib/tests/baseline_images/test_image/uint16.tif")) fails with |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | anntzer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6 |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8aae7b8d6caacacf5c66eaeb2702d8dc88d85b4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width