Use namedtuple _replace

This commit is contained in:
Andrew Murray 2025-01-01 12:43:50 +11:00
parent 2486361002
commit bd56a95659

View File

@ -374,11 +374,9 @@ class BLP1Decoder(_BLPBaseDecoder):
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].args
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())