Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for BLP file format #3007

Merged
merged 8 commits into from
Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ Changelog (Pillow)
- Change function declaration to match Tcl_CmdProc type #1966
[homm]

- Integer overflow checks on all calls to *alloc #1781
- Integer overflow checks on all calls to \*alloc #1781
[wiredfool]

- Change equals method on Image so it short circuits #1967
Expand Down
Binary file added Tests/images/blp/blp1_jpeg.blp
Binary file not shown.
Binary file added Tests/images/blp/blp2_dxt1.blp
Binary file not shown.
Binary file added Tests/images/blp/blp2_dxt1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/blp/blp2_dxt1a.blp
Binary file not shown.
Binary file added Tests/images/blp/blp2_dxt1a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/blp/blp2_raw.blp
Binary file not shown.
Binary file added Tests/images/blp/blp2_raw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions Tests/test_file_blp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from PIL import Image

from helper import PillowTestCase, unittest


class TestFileBlp(PillowTestCase):
def test_load_blp2_raw(self):
im = Image.open("Tests/images/blp/blp2_raw.blp")
target = Image.open("Tests/images/blp/blp2_raw.png")
self.assert_image_equal(im, target)

def test_load_blp2_dxt1(self):
im = Image.open("Tests/images/blp/blp2_dxt1.blp")
target = Image.open("Tests/images/blp/blp2_dxt1.png")
self.assert_image_equal(im, target)

def test_load_blp2_dxt1a(self):
im = Image.open("Tests/images/blp/blp2_dxt1a.blp")
target = Image.open("Tests/images/blp/blp2_dxt1a.png")
self.assert_image_equal(im, target)


if __name__ == "__main__":
unittest.main()
Loading