mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-09-24 13:07:00 +03:00
Use _ensure_mutable
This commit is contained in:
parent
b7e0570cb1
commit
3a580e0f79
|
@ -2070,9 +2070,7 @@ class Image:
|
||||||
:param value: The pixel value.
|
:param value: The pixel value.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.readonly:
|
self._ensure_mutable()
|
||||||
self._copy()
|
|
||||||
self.load()
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
self.mode in ("P", "PA")
|
self.mode in ("P", "PA")
|
||||||
|
|
|
@ -76,9 +76,7 @@ class ImageDraw:
|
||||||
must be the same as the image mode. If omitted, the mode
|
must be the same as the image mode. If omitted, the mode
|
||||||
defaults to the mode of the image.
|
defaults to the mode of the image.
|
||||||
"""
|
"""
|
||||||
im.load()
|
im._ensure_mutable()
|
||||||
if im.readonly:
|
|
||||||
im._copy() # make it writeable
|
|
||||||
blend = 0
|
blend = 0
|
||||||
if mode is None:
|
if mode is None:
|
||||||
mode = im.mode
|
mode = im.mode
|
||||||
|
|
Loading…
Reference in New Issue
Block a user