mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Merge pull request #4685 from Meithal/patch-3
Correctly read JPEG compressed BLP images
This commit is contained in:
commit
3d33987d7c
BIN
Tests/images/blp/blp1_jpeg.png
Normal file
BIN
Tests/images/blp/blp1_jpeg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
|
@ -5,6 +5,11 @@ from PIL import BlpImagePlugin, Image
|
|||
from .helper import assert_image_equal_tofile
|
||||
|
||||
|
||||
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")
|
||||
|
||||
|
||||
def test_load_blp2_raw():
|
||||
with Image.open("Tests/images/blp/blp2_raw.blp") as im:
|
||||
assert_image_equal_tofile(im, "Tests/images/blp/blp2_raw.png")
|
||||
|
|
|
@ -392,9 +392,9 @@ class BLP1Decoder(_BLPBaseDecoder):
|
|||
data = BytesIO(data)
|
||||
image = JpegImageFile(data)
|
||||
Image._decompression_bomb_check(image.size)
|
||||
self.tile = image.tile # :/
|
||||
self.fd = image.fp
|
||||
self.mode = image.mode
|
||||
image.mode = "RGB"
|
||||
image.tile = [("jpeg", (0, 0) + self.size, 0, ("BGRX", ""))]
|
||||
self.set_as_raw(image.tobytes())
|
||||
|
||||
|
||||
class BLP2Decoder(_BLPBaseDecoder):
|
||||
|
|
Loading…
Reference in New Issue
Block a user