Removed support for RGB bitcount 8

This commit is contained in:
Andrew Murray 2023-12-02 00:35:40 +11:00
parent 56b4822294
commit ab96324c12
4 changed files with 2 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 861 B

View File

@ -41,7 +41,7 @@ TEST_FILE_UNCOMPRESSED_RGB_WITH_ALPHA = "Tests/images/uncompressed_rgb.dds"
TEST_FILE_DX10_BC1_TYPELESS, TEST_FILE_DX10_BC1_TYPELESS,
), ),
) )
def test_sanity_bc1(image_path): def test_sanity_dxt1_bc1(image_path):
"""Check DXT1 images can be opened""" """Check DXT1 images can be opened"""
with Image.open(TEST_FILE_DXT1.replace(".dds", ".png")) as target: with Image.open(TEST_FILE_DXT1.replace(".dds", ".png")) as target:
target = target.convert("RGBA") target = target.convert("RGBA")
@ -350,12 +350,6 @@ def test_save_unsupported_mode(tmp_path):
im.save(out) im.save(out)
def test_open_rgb8():
with Image.open("Tests/images/rgb8.dds") as im:
assert im.mode == "L"
assert_image_equal_tofile(im, "Tests/images/rgb8.png")
@pytest.mark.parametrize( @pytest.mark.parametrize(
("mode", "test_file"), ("mode", "test_file"),
[ [

View File

@ -351,9 +351,7 @@ class DdsImageFile(ImageFile.ImageFile):
# Texture contains uncompressed RGB data # Texture contains uncompressed RGB data
masks = struct.unpack("<4I", header.read(16)) masks = struct.unpack("<4I", header.read(16))
masks = {mask: ["R", "G", "B", "A"][i] for i, mask in enumerate(masks)} masks = {mask: ["R", "G", "B", "A"][i] for i, mask in enumerate(masks)}
if bitcount == 8: if bitcount == 24:
self._mode = "L"
elif bitcount == 24:
self._mode = "RGB" self._mode = "RGB"
rawmode = masks[0x000000FF] + masks[0x0000FF00] + masks[0x00FF0000] rawmode = masks[0x000000FF] + masks[0x0000FF00] + masks[0x00FF0000]
elif bitcount == 32 and pfflags & DDPF.ALPHAPIXELS: elif bitcount == 32 and pfflags & DDPF.ALPHAPIXELS: