From cd4adb1677426c45ec50bb7a0f7fabc592315e1c Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 27 Sep 2023 19:41:45 +1000 Subject: [PATCH 1/3] Added reading 8-bit color images --- Tests/images/palette.dds | Bin 0 -> 31152 bytes Tests/test_file_dds.py | 5 +++++ src/PIL/DdsImagePlugin.py | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 Tests/images/palette.dds diff --git a/Tests/images/palette.dds b/Tests/images/palette.dds new file mode 100644 index 0000000000000000000000000000000000000000..7171cb1f2428ff3f76e0d4dec46b4a69574bf587 GIT binary patch literal 31152 zcmeI44LsF%|NkB2CWMp@r;g$vN4d$IlO;+dx#@P|`cN~vj;d?g+2bc=J-8^Tyy5QSwmOFFqmk#6cL;6jP%N&WE z9Q(z*Qqh{hJoY{O^wUoy(cGMPf9OrZ!dl3rNuLsZ{aYj_CxncNA45Vu4IwEh-;+rp zlgM|5hUBA<=8>jv8_CDzACsfUlgYYu<-|C_n0)$)1@TDpAR9|I5;e6PQdG2_v`HjH zGIlJv~} zs!k#~d>H3Ui0OG#Vp?oUCQK**uY`oDtC5C=%cSzVO48QRMjq(t6BCoWWX~QkS-P}~ z-2UJq`FBnZvE6P<($k$u>4pu2ca}#MF3cvgXP+fg_e~|)*<(ri)TyMSqmk(99wUFr z%OfQvoh0qMH1b{Bw1anKNDZozF;gR1`S}&b{{b#Mt;dA{Kv13=N-a=GNmKmSSQxP3(`FhB0@Rpjh+dy;QsL*j48L;D}dtXU1DIVgyn zI^{=NTc47D|JXs?+^yaMXafZJ9tm`Q#I_Y`%cJqpnSgw6sY35o!7UG1<3ImwW?1{qa9tBqMVy`Ow0GEKOWWj!v;Ar%%62&T8rq&10IR-e5er zR&b4!{!mJ8PMAO(9ZN{<{W{X}WdX5>v>+=~tjGuWok_`)$mICRf9l5uJx$+Ood zhYy>R-MdE-i^-*A+_?9NPK*vIIuS-n1rFr4(^PV7+-y>fxJkrk^ZC^z+|m+$w~M@c z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tj!GuF>ToRG zxw5GT(YSbY-a1Fvx^?U3&71W4>#y5?27CSWN%Qb>-aOj}x27~T+cqnin6MnOnRkhX z$^LadK0XwKa`d&cXOA8|J89Ab$i;9d-M%fme&sPi$!Gt53Nr8PS&VwpS^UQsD2`5^ ze00*JdCkqXW7Tzam71EC%4)tMCok!$tE>AsHrp}`ECM~AJvv!av(lI<0`D5zq^_={ zt}eTJkntwEO6oq&V{PZbi=Q2vJ;<`T$V86K&FdI1 z>IH!w#>SeHsU9%fu~V85>bkPaadP}my6Vl%KJX&V%I;w^f*?BB*YGQFOp$F42%_5r z4rAlWojXxX5bfRWh0F^A#%|pjI|ZSxYcgI27g21-aB{A$`q*Y4btPju|4ja+scM}R z;T90aj->}0>L%ldq|Nv}A0jv2M19JXrjhFE`}ZHEwPYPa1wQ4|OaT}IdW0ZNP3kht zL6%L>9eI1{QnVkAOi6U4u~KQg-;rW;o2@OVn$;)BXj?)Bq=GEHjb72&8U0B!jd{dM ze+~r6gIl+nl`hF>Tf#Wv$)6y|?I|$lX4_l0Y#sL-8>7afM}##yI{G*|-vY;jTRyVv zRzQIuEXUYe4=`L?M;~-5z_3MGp>>5}x^>G@>5>fGB+5+vzz3wPk?^c3EJk-ojD<7N zy2AJv0^M0@!m5G)US`fNgJ&@ywzl(-u~?6SFHsI-W5mijTU$q^39?%}q%(<7*G0mb z;_OH>?tULg0s&~=b=<#y|K!PN>3x79%R$bPoCFABy=gyF)un7N78Qwn0^sO9nE$0E@n_MZn`HdlpXeGx7b_+u^tL7wCS003ewD|cMv5K> zlUufI{M@-eVf>fo&K*B~S>m4$p_fJO Date: Sat, 30 Sep 2023 11:32:54 +1000 Subject: [PATCH 2/3] Added release notes --- docs/handbook/image-file-formats.rst | 3 ++- docs/releasenotes/10.1.0.rst | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/handbook/image-file-formats.rst b/docs/handbook/image-file-formats.rst index 2a42bdacba7..7e6712d30e1 100644 --- a/docs/handbook/image-file-formats.rst +++ b/docs/handbook/image-file-formats.rst @@ -64,7 +64,8 @@ DDS DDS is a popular container texture format used in video games and natively supported by DirectX. Uncompressed RGB and RGBA can be read, and (since 8.3.0) written. DXT1, -DXT3 (since 3.4.0) and DXT5 pixel formats can be read, only in ``RGBA`` mode. +DXT3 (since 3.4.0) and DXT5 pixel formats can be read, only in ``RGBA`` mode. Since +10.1.0, 8-bit color indexed files can be read as ``P`` mode images. DIB ^^^ diff --git a/docs/releasenotes/10.1.0.rst b/docs/releasenotes/10.1.0.rst index da5153cceef..087062dfd38 100644 --- a/docs/releasenotes/10.1.0.rst +++ b/docs/releasenotes/10.1.0.rst @@ -48,7 +48,7 @@ TODO Other Changes ============= -TODO -^^^^ +Added support for DDS 8-bit color indexed images +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -TODO +Support has been added to read PALETTEINDEXED8 DDS files as P mode images. From 114aadd2ca8bf6bb7a4a6eaf45310c4328f713d5 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 1 Oct 2023 06:13:40 +1100 Subject: [PATCH 3/3] Added versionadded --- docs/handbook/image-file-formats.rst | 32 +++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/docs/handbook/image-file-formats.rst b/docs/handbook/image-file-formats.rst index 7e6712d30e1..1f785bc21a3 100644 --- a/docs/handbook/image-file-formats.rst +++ b/docs/handbook/image-file-formats.rst @@ -63,9 +63,35 @@ DDS ^^^ DDS is a popular container texture format used in video games and natively supported -by DirectX. Uncompressed RGB and RGBA can be read, and (since 8.3.0) written. DXT1, -DXT3 (since 3.4.0) and DXT5 pixel formats can be read, only in ``RGBA`` mode. Since -10.1.0, 8-bit color indexed files can be read as ``P`` mode images. +by DirectX. + +DXT1 and DXT5 pixel formats can be read, only in ``RGBA`` mode. + +.. versionadded:: 3.4.0 + DXT3 images can be read in ``RGB`` mode and DX10 images can be read in + ``RGB`` and ``RGBA`` mode. + +.. versionadded:: 6.0.0 + Uncompressed ``RGBA`` images can be read. + + +.. versionadded:: 8.3.0 + BC5S images can be opened in ``RGB`` mode, and uncompressed ``RGB`` images + can be read. Uncompressed data can also be saved to image files. + + +.. versionadded:: 9.3.0 + ATI1 images can be opened in ``L`` mode and ATI2 images can be opened in + ``RGB`` mode. + +.. versionadded:: 9.4.0 + Uncompressed ``L`` ("luminance") and ``LA`` images can be opened and saved. + + +.. versionadded:: 10.1.0 + BC5U can be read in ``RGB`` mode, and 8-bit color indexed images can be read + in ``P`` mode. + DIB ^^^