From 919f38e3d9b13aef38b87a7e08ce8ba879be7cf3 Mon Sep 17 00:00:00 2001 From: Meithal Date: Mon, 5 Jul 2021 00:20:15 +0200 Subject: [PATCH] Try test --- Tests/images/blp/blp1_jpeg.jpg | Bin 0 -> 1651 bytes Tests/images/blp/blp1_jpeg.png | Bin 0 -> 270 bytes Tests/images/blp/war3mapMap.blp | Bin 0 -> 19430 bytes Tests/images/blp/war3mapMap.jpg | Bin 0 -> 1651 bytes Tests/images/blp/war3mapMap.png | Bin 0 -> 270 bytes Tests/test_file_blp.py | 6 ++++++ src/PIL/BlpImagePlugin.py | 14 ++++++++++++-- 7 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 Tests/images/blp/blp1_jpeg.jpg create mode 100644 Tests/images/blp/blp1_jpeg.png create mode 100644 Tests/images/blp/war3mapMap.blp create mode 100644 Tests/images/blp/war3mapMap.jpg create mode 100644 Tests/images/blp/war3mapMap.png diff --git a/Tests/images/blp/blp1_jpeg.jpg b/Tests/images/blp/blp1_jpeg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c045c5945c1071f3d4bd4e3f0d878cec6899bc17 GIT binary patch literal 1651 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<uA z0}~@NGZPClD=P~NP<1U(o`FS>RY=j$kxe)-kzJ`!#HexNLJno8jR!@8E`CrkPAY2R z|V^&07y2J$~}^+4C1KUw!=a`ODXD-+%o41@afjpD+ON7@EHXf&OA*VPR%r2lxYE#}NLy#lXYN2#h>tK?Zwfl gP32wyWDa4_AkC=Dz<6e<1v|(Sp00i_>zopr0LjD?Hvj+t literal 0 HcmV?d00001 diff --git a/Tests/images/blp/war3mapMap.blp b/Tests/images/blp/war3mapMap.blp new file mode 100644 index 0000000000000000000000000000000000000000..03afb3aa5919a856946c916056f89a522ad82692 GIT binary patch literal 19430 zcmeIaXH-*N+b+67RZvj`DI%bNR0RbT5C|4PKzi>8A|+C!7a_rhQbehWKtxLDL3$60 zfOP2s(tEF=rR^2a=Y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jpg new file mode 100644 index 0000000000000000000000000000000000000000..c045c5945c1071f3d4bd4e3f0d878cec6899bc17 GIT binary patch literal 1651 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<uA z0}~@NGZPClD=P~NP<1U(o`FS>RY=j$kxe)-kzJ`!#HexNLJno8jR!@8E`CrkPAY2R z|V^&07y2J$~}^+4C1KUw!=a`ODXD-+%o41@afjpD+ON7@EHXf&OA*VPR%r2lxYE#}NLy#lXYN2#h>tK?Zwfl gP32wyWDa4_AkC=Dz<6e<1v|(Sp00i_>zopr0LjD?Hvj+t literal 0 HcmV?d00001 diff --git a/Tests/test_file_blp.py b/Tests/test_file_blp.py index 15bd7e4f8..3e4401996 100644 --- a/Tests/test_file_blp.py +++ b/Tests/test_file_blp.py @@ -20,6 +20,12 @@ def test_load_blp2_dxt1a(): assert_image_equal_tofile(im, "Tests/images/blp/blp2_dxt1a.png") +def test_load_blp1(): + with Image.open("Tests/images/blp/war3mapMap.blp") as im: + im.convert("RGB") + assert_image_equal_tofile(im, "Tests/images/blp/war3mapMap.png") + + @pytest.mark.parametrize( "test_file", [ diff --git a/src/PIL/BlpImagePlugin.py b/src/PIL/BlpImagePlugin.py index f62b1bebe..c286a8197 100644 --- a/src/PIL/BlpImagePlugin.py +++ b/src/PIL/BlpImagePlugin.py @@ -28,7 +28,7 @@ BLP files come in many different flavours: - DXT3 compression is used if alpha_encoding == 1. - DXT5 compression is used if alpha_encoding == 7. """ - +print("foo") import struct from io import BytesIO @@ -245,7 +245,7 @@ class BlpImageFile(ImageFile.ImageFile): if self.magic == b"BLP1": decoder = "BLP1" - self.mode = "RGBA" + self.mode = "BGRA" elif self.magic == b"BLP2": decoder = "BLP2" self.mode = "RGBA" if self._blp_alpha_depth else "RGB" @@ -361,6 +361,16 @@ class BLP1Decoder(_BLPBaseDecoder): image.tile = [("jpeg", (0, 0) + self.size, 0, ("RGBA", ""))] b, g, r, a = image.split() + print(b, g, r, a) + if not any( + [a.getpixel((x, y)) for x in range(a.width) for y in range(a.height)] + ): + # try to unprotect completely transparent pictures + from PIL import ImageOps + + a = ImageOps.invert(a) + + image = Image.merge("RGBA", (r, g, b, a)) self.set_as_raw(image.tobytes())