Use numpy.array with dtype

Thank you @radarhere.

Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
Thomas Viehmann 2021-07-01 14:08:51 +02:00 committed by GitHub
parent 73f6cf22f3
commit 8d1b433c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -700,10 +700,7 @@ class Image:
class ArrayData:
__array_interface__ = new
arr = np.array(ArrayData())
if dtype is not None:
arr = arr.astype(dtype)
return arr
return np.array(ArrayData(), dtype)
def __getstate__(self):
return [self.info, self.mode, self.size, self.getpalette(), self.tobytes()]