Decode JPEG compressed BLP1 data in original mode

This commit is contained in:
Andrew Murray 2022-10-15 22:30:53 +11:00
parent be8a28d03d
commit f7363c1091
3 changed files with 5 additions and 2 deletions

Binary file not shown.

View File

@ -14,6 +14,9 @@ def test_load_blp1():
with Image.open("Tests/images/blp/blp1_jpeg.blp") as im:
assert_image_equal_tofile(im, "Tests/images/blp/blp1_jpeg.png")
with Image.open("Tests/images/blp/blp1_jpeg2.blp") as im:
im.load()
def test_load_blp2_raw():
with Image.open("Tests/images/blp/blp2_raw.blp") as im:

View File

@ -373,8 +373,8 @@ class BLP1Decoder(_BLPBaseDecoder):
data = BytesIO(data)
image = JpegImageFile(data)
Image._decompression_bomb_check(image.size)
image.mode = "RGB"
image.tile = [("jpeg", (0, 0) + self.size, 0, ("BGRX", ""))]
r, g, b = image.convert("RGB").split()
image = Image.merge("RGB", (b, g, r))
self.set_as_raw(image.tobytes())