Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 791c4d5 commit dddc262Copy full SHA for dddc262
1 file changed
lib/matplotlib/image.py
@@ -1313,7 +1313,10 @@ def pil_to_array(pilImage):
1313
"""
1314
def toarray(im, dtype=np.uint8):
1315
"""Teturn a 1D array of dtype."""
1316
- x_str = im.tobytes('raw', im.mode)
+ if hasattr(im, 'tobytes'):
1317
+ x_str = im.tobytes('raw', im.mode)
1318
+ else:
1319
+ x_str = im.tostring('raw', im.mode)
1320
x = np.fromstring(x_str, dtype)
1321
return x
1322
0 commit comments