Skip to content

Commit 0e25859

Browse files
authored
Merge pull request #13415 from meeseeksmachine/auto-backport-of-pr-13405-on-v2.2.x
Backport PR #13405 on branch v2.2.x (Fix imshow()ing PIL-opened images.)
2 parents 1fc42b3 + f6eac94 commit 0e25859

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

lib/matplotlib/image.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -635,15 +635,7 @@ def set_data(self, A):
635635
636636
Note that this function does *not* update the normalization used.
637637
"""
638-
# check if data is PIL Image without importing Image
639-
if hasattr(A, 'getpixel'):
640-
if A.mode == 'L':
641-
# greyscale image, but our logic assumes rgba:
642-
self._A = pil_to_array(A.convert('RGBA'))
643-
else:
644-
self._A = pil_to_array(A)
645-
else:
646-
self._A = cbook.safe_masked_invalid(A, copy=True)
638+
self._A = cbook.safe_masked_invalid(A, copy=True)
647639

648640
if (self._A.dtype != np.uint8 and
649641
not np.can_cast(self._A.dtype, float, "same_kind")):

0 commit comments

Comments
 (0)