From ab96324c1260d82fb3f654efa8f527bc28800e4b Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 2 Dec 2023 00:35:40 +1100 Subject: [PATCH] Removed support for RGB bitcount 8 --- Tests/images/rgb8.dds | Bin 16512 -> 0 bytes Tests/images/rgb8.png | Bin 861 -> 0 bytes Tests/test_file_dds.py | 8 +------- src/PIL/DdsImagePlugin.py | 4 +--- 4 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 Tests/images/rgb8.dds delete mode 100644 Tests/images/rgb8.png diff --git a/Tests/images/rgb8.dds b/Tests/images/rgb8.dds deleted file mode 100644 index 8193e8e5ac64c3f6921bb59ba3a4fe33910bf028..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16512 zcmeH}&21Yo5QR54-x7CVsD(6;gE|P@O%ATd#kmEAKVt$jocD$+L0AYH0=7iGCBDax zi^ZPLf8YLX+xGLZAA{&^`M-+$Xy7<63vfY*HW0rSs3U`_*p z!wLe26$E}|1x2qD(^b*y#N>)zCngW36W$b<@TS0o-&Me&D+LZ+DRAg}6af5C0PsTr zz%MH}m=EzH0B&Cd!0oRIAox~*;9CKLUn+1gpW=%Ey8R-6Zht|*lk@4t;7e?I^C@!$UZ=Lb+;8)<=((>pMD?W{4q0ZM*vJ}c1blL9R#0$Lva zg9c7$6p);YLU}G{hlTs3g=g`eL0fLEUTfcft}U`_*p!wLe26$E}|1x2qD(^b*y#N>)zCngW36W$b< z@TS0o-&Me&D+LZ+DRAg}6af5C0PsTrz%MH}m=EzH0B&Cd!0oRIAox~*;9CKLUn+1g zpW=%Ey8R-6Zht|*lk@4t;7e?I^C@!$UZ=Lb+;8)<=( z(>pMD?W{4q0ZM*vJ}c1blL9R#0$Lvag9c7$6p); zYLU}G{hlTs3g=g`ZA+z$;(-fccL;U`_*p!wLe2 z6$E}|1x2qD(^b*y#N>)zCngW36W$b<@TS0o-&Me&D+LZ+DRAg}6af5C0PsTrz%MH} zm=EzH0B&Cd!0oRIAox~*;9CKLUn+1gpW=%Ey8R-6Zht|*lk@4t;7e?I^C@!$UZ=Lb+;8)<=((>pMD?W{4q0ZM*vJ}c1blL9R#0$Lvag9c7$6p);YLU}G{hl vTs3g=g`cDXyizK_Tq?jkgEWu^(m)zW18E=)q=7V$2GT$pNCRo$5Ci`K#A3DB diff --git a/Tests/images/rgb8.png b/Tests/images/rgb8.png deleted file mode 100644 index 9d22a26a446d3dbdfd8f9c931ea466f6c6424e90..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 861 zcmeAS@N?(olHy`uVBq!ia0vp^4Is<`Bp9BB+KDqTFspdFIEGZrc^h?ls*<5Vur)JB zqlg-7P(pKyh(}`Z41qR*8_gT%*K1u(y=E67zCX-RIr5$RbYFRmk9~(3o90{0iTo?q zZokIPVc}P`n#F#$cTRI}Z`b*cHdxb-Qkj7%xN9XC&Z5~v}sUc zQF_LyDDi8i`mdSklfSkId~vT6XS8VuNn~8YHGhS2Q^L#RQrG)UyL@3X&}x&GB>;Tib{;+mb; z9E?oS*}aKX$Uxa5;eK2CjmcMXGaH^hIH47DKd5laQEeT@eua-ZO-D9&R()gjOuir% zvW=}bGBx``)z5EfnVi1_vX=2LOsg_|ey?EeT|36sB|Uh!dQU<13AVi4r5g)!U-!1I-}Y|HguFw3`xCAHw!QqqenxjbTuMSUDiOXag;?62vFzD;OU-N3|GNKs$H|s>F&hgWVD=Cdb6BTa*mH8 zSvtelvqpRLzjllcxGA-Tb?VxK$@jOLdwX91dKc*H#c{mLBht%bs(#FW&Mb`zE`Q|r X-moxli&n>DP`>eW^>bP0l+XkK*RXjv diff --git a/Tests/test_file_dds.py b/Tests/test_file_dds.py index da7260cbf..e0f9fe7de 100644 --- a/Tests/test_file_dds.py +++ b/Tests/test_file_dds.py @@ -41,7 +41,7 @@ TEST_FILE_UNCOMPRESSED_RGB_WITH_ALPHA = "Tests/images/uncompressed_rgb.dds" TEST_FILE_DX10_BC1_TYPELESS, ), ) -def test_sanity_bc1(image_path): +def test_sanity_dxt1_bc1(image_path): """Check DXT1 images can be opened""" with Image.open(TEST_FILE_DXT1.replace(".dds", ".png")) as target: target = target.convert("RGBA") @@ -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"), [ diff --git a/src/PIL/DdsImagePlugin.py b/src/PIL/DdsImagePlugin.py index 407d33d85..bdcb8da36 100644 --- a/src/PIL/DdsImagePlugin.py +++ b/src/PIL/DdsImagePlugin.py @@ -351,9 +351,7 @@ class DdsImageFile(ImageFile.ImageFile): # 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: