Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2070,9 +2070,7 @@ def putpixel(
:param value: The pixel value.
"""

if self.readonly:
self._copy()
self.load()
self._ensure_mutable()

if (
self.mode in ("P", "PA")
Expand Down
4 changes: 1 addition & 3 deletions src/PIL/ImageDraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ def __init__(self, im: Image.Image, mode: str | None = None) -> None:
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
Expand Down
Loading