Skip to content

Commit

Permalink
Use namedtuple _replace
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jan 1, 2025
1 parent aa0f412 commit 1955f07
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/PIL/BlpImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,9 @@ def _decode_jpeg_stream(self) -> None:
image = JpegImageFile(BytesIO(data))
Image._decompression_bomb_check(image.size)
if image.mode == "CMYK":
decoder_name, extents, offset, args = image.tile[0]
args = image.tile[0][3]
assert isinstance(args, tuple)
image.tile = [
ImageFile._Tile(decoder_name, extents, offset, (args[0], "CMYK"))
]
image.tile = [image.tile[0]._replace(args=(args[0], "CMYK"))]
r, g, b = image.convert("RGB").split()
reversed_image = Image.merge("RGB", (b, g, r))
self.set_as_raw(reversed_image.tobytes())
Expand Down

0 comments on commit 1955f07

Please sign in to comment.