diff --git a/Tests/images/dxt5-colorblock-alpha-issue-4142.dds b/Tests/images/dxt5-colorblock-alpha-issue-4142.dds new file mode 100644 index 000000000..905527ead Binary files /dev/null and b/Tests/images/dxt5-colorblock-alpha-issue-4142.dds differ diff --git a/Tests/test_file_dds.py b/Tests/test_file_dds.py index 1cd7a1be7..5651c2e4d 100644 --- a/Tests/test_file_dds.py +++ b/Tests/test_file_dds.py @@ -190,6 +190,21 @@ def test_short_file(): short_file() +def test_dxt5_colorblock_alpha_issue_4142(): + """ Check that colorblocks are decoded correctly in DXT5""" + + with Image.open("Tests/images/dxt5-colorblock-alpha-issue-4142.dds") as im: + px = im.getpixel((0, 0)) + assert px[0] != 0 + assert px[1] != 0 + assert px[2] != 0 + + px = im.getpixel((1, 0)) + assert px[0] != 0 + assert px[1] != 0 + assert px[2] != 0 + + def test_unimplemented_pixel_format(): with pytest.raises(NotImplementedError): Image.open("Tests/images/unimplemented_pixel_format.dds")