Skip to content

Commit

Permalink
Removed support for RGB bitcount 8
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Dec 1, 2023
1 parent 2297595 commit b6c0504
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 9 deletions.
Binary file removed Tests/images/rgb8.dds
Binary file not shown.
Binary file removed Tests/images/rgb8.png
Binary file not shown.
6 changes: 0 additions & 6 deletions Tests/test_file_dds.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,6 @@ def test_save_unsupported_mode(tmp_path):
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(
("mode", "test_file"),
[
Expand Down
4 changes: 1 addition & 3 deletions src/PIL/DdsImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,7 @@ def _open(self):
# Texture contains uncompressed RGB data
masks = struct.unpack("<4I", header.read(16))
masks = {mask: ["R", "G", "B", "A"][i] for i, mask in enumerate(masks)}
if bitcount == 8:
self._mode = "L"
elif bitcount == 24:
if bitcount == 24:
self._mode = "RGB"
rawmode = masks[0x000000FF] + masks[0x0000FF00] + masks[0x00FF0000]
elif bitcount == 32 and pfflags & DDPF.ALPHAPIXELS:
Expand Down

0 comments on commit b6c0504

Please sign in to comment.