Skip to content

Commit f7363c1

Browse files
committed
Decode JPEG compressed BLP1 data in original mode
1 parent be8a28d commit f7363c1

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Tests/images/blp/blp1_jpeg2.blp

2.77 KB
Binary file not shown.

Tests/test_file_blp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ def test_load_blp1():
1414
with Image.open("Tests/images/blp/blp1_jpeg.blp") as im:
1515
assert_image_equal_tofile(im, "Tests/images/blp/blp1_jpeg.png")
1616

17+
with Image.open("Tests/images/blp/blp1_jpeg2.blp") as im:
18+
im.load()
19+
1720

1821
def test_load_blp2_raw():
1922
with Image.open("Tests/images/blp/blp2_raw.blp") as im:

src/PIL/BlpImagePlugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ def _decode_jpeg_stream(self):
373373
data = BytesIO(data)
374374
image = JpegImageFile(data)
375375
Image._decompression_bomb_check(image.size)
376-
image.mode = "RGB"
377-
image.tile = [("jpeg", (0, 0) + self.size, 0, ("BGRX", ""))]
376+
r, g, b = image.convert("RGB").split()
377+
image = Image.merge("RGB", (b, g, r))
378378
self.set_as_raw(image.tobytes())
379379

380380

0 commit comments

Comments
 (0)