Skip to content

Commit

Permalink
Use numpy.array with dtype
Browse files Browse the repository at this point in the history
Thank you @radarhere.

Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
  • Loading branch information
t-vi and radarhere committed Jul 6, 2021
1 parent 2ebb695 commit 76037e5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/PIL/Image.py
Expand Up @@ -700,10 +700,7 @@ def __array__(self, dtype=None):
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()]
Expand Down

0 comments on commit 76037e5

Please sign in to comment.