diff --git a/Tests/images/blp/blp1_jpeg2.blp b/Tests/images/blp/blp1_jpeg2.blp new file mode 100644 index 000000000..890180e9b Binary files /dev/null and b/Tests/images/blp/blp1_jpeg2.blp differ diff --git a/Tests/test_file_blp.py b/Tests/test_file_blp.py index c1fae44ca..ba2781820 100644 --- a/Tests/test_file_blp.py +++ b/Tests/test_file_blp.py @@ -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: diff --git a/src/PIL/BlpImagePlugin.py b/src/PIL/BlpImagePlugin.py index 104fbada9..533997737 100644 --- a/src/PIL/BlpImagePlugin.py +++ b/src/PIL/BlpImagePlugin.py @@ -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())