diff --git a/src/PIL/Image.py b/src/PIL/Image.py index b17fd131d..95bf2da3f 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -2070,9 +2070,7 @@ class Image: :param value: The pixel value. """ - if self.readonly: - self._copy() - self.load() + self._ensure_mutable() if ( self.mode in ("P", "PA") diff --git a/src/PIL/ImageDraw.py b/src/PIL/ImageDraw.py index ed46899b4..1384f1169 100644 --- a/src/PIL/ImageDraw.py +++ b/src/PIL/ImageDraw.py @@ -76,9 +76,7 @@ class ImageDraw: must be the same as the image mode. If omitted, the mode defaults to the mode of the image. """ - im.load() - if im.readonly: - im._copy() # make it writeable + im._ensure_mutable() blend = 0 if mode is None: mode = im.mode