Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 831a13c

Browse files
authored
Merge pull request #20565 from jklymak/fix-pil-asarray
FIX: PILLOW asarray bug
2 parents cccb566 + 5a4f6f0 commit 831a13c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1688,7 +1688,7 @@ def _pil_png_to_float_array(pil_png):
16881688
mode = pil_png.mode
16891689
rawmode = pil_png.png.im_rawmode
16901690
if rawmode == "1": # Grayscale.
1691-
return np.asarray(pil_png, np.float32)
1691+
return np.asarray(pil_png).astype(np.float32)
16921692
if rawmode == "L;2": # Grayscale.
16931693
return np.divide(pil_png, 2**2 - 1, dtype=np.float32)
16941694
if rawmode == "L;4": # Grayscale.

0 commit comments

Comments
 (0)