Merge pull request #8652 from radarhere/tile

This commit is contained in:
Hugo van Kemenade 2025-01-08 19:03:31 +02:00 committed by GitHub
commit 01792cbff0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 7 deletions

View File

@ -374,14 +374,10 @@ class BLP1Decoder(_BLPBaseDecoder):
image = JpegImageFile(BytesIO(data)) image = JpegImageFile(BytesIO(data))
Image._decompression_bomb_check(image.size) Image._decompression_bomb_check(image.size)
if image.mode == "CMYK": if image.mode == "CMYK":
decoder_name, extents, offset, args = image.tile[0] args = image.tile[0].args
assert isinstance(args, tuple) assert isinstance(args, tuple)
image.tile = [ image.tile = [image.tile[0]._replace(args=(args[0], "CMYK"))]
ImageFile._Tile(decoder_name, extents, offset, (args[0], "CMYK")) self.set_as_raw(image.convert("RGB").tobytes(), "BGR")
]
r, g, b = image.convert("RGB").split()
reversed_image = Image.merge("RGB", (b, g, r))
self.set_as_raw(reversed_image.tobytes())
class BLP2Decoder(_BLPBaseDecoder): class BLP2Decoder(_BLPBaseDecoder):

View File

@ -1664,6 +1664,7 @@ static struct {
{"RGBA", "RGBaXX", 48, unpackRGBaskip2}, {"RGBA", "RGBaXX", 48, unpackRGBaskip2},
{"RGBA", "RGBa;16L", 64, unpackRGBa16L}, {"RGBA", "RGBa;16L", 64, unpackRGBa16L},
{"RGBA", "RGBa;16B", 64, unpackRGBa16B}, {"RGBA", "RGBa;16B", 64, unpackRGBa16B},
{"RGBA", "BGR", 24, ImagingUnpackBGR},
{"RGBA", "BGRa", 32, unpackBGRa}, {"RGBA", "BGRa", 32, unpackBGRa},
{"RGBA", "RGBA;I", 32, unpackRGBAI}, {"RGBA", "RGBA;I", 32, unpackRGBAI},
{"RGBA", "RGBA;L", 32, unpackRGBAL}, {"RGBA", "RGBA;L", 32, unpackRGBAL},