mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
ducktype the array_interface obj to see if it provides tobytes or tostring
This commit is contained in:
parent
c3d6b05d10
commit
587b9a79d8
|
@ -1944,7 +1944,10 @@ def fromarray(obj, mode=None):
|
|||
|
||||
size = shape[1], shape[0]
|
||||
if strides is not None:
|
||||
obj = obj.tostring()
|
||||
if hasattr(obj, 'tobytes'):
|
||||
obj = obj.tobytes()
|
||||
else:
|
||||
obj = obj.tostring()
|
||||
|
||||
return frombuffer(mode, size, obj, "raw", rawmode, 0, 1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user