Skip to content

Commit cf9e2ae

Browse files
authored
Merge pull request #1 from radarhere/ATI1-2_support
Sort formats by n
2 parents 1050d13 + 4276340 commit cf9e2ae

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/PIL/DdsImagePlugin.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
DDS_CUBEMAP_POSITIVEZ = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEZ
8383
DDS_CUBEMAP_NEGATIVEZ = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEZ
8484

85+
8586
# DXT1
8687
DXT1_FOURCC = 0x31545844
8788

@@ -155,6 +156,14 @@ def _open(self):
155156
elif fourcc == b"DXT5":
156157
self.pixel_format = "DXT5"
157158
n = 3
159+
elif fourcc == b"ATI1":
160+
self.pixel_format = "BC4"
161+
n = 4
162+
self.mode = "L"
163+
elif fourcc == b"ATI2":
164+
self.pixel_format = "BC5"
165+
n = 5
166+
self.mode = "RGB"
158167
elif fourcc == b"BC5S":
159168
self.pixel_format = "BC5S"
160169
n = 5
@@ -192,14 +201,6 @@ def _open(self):
192201
raise NotImplementedError(
193202
f"Unimplemented DXGI format {dxgi_format}"
194203
)
195-
elif fourcc == b"ATI1":
196-
self.pixel_format = "BC4"
197-
n = 4
198-
self.mode = "L"
199-
elif fourcc == b"ATI2":
200-
self.pixel_format = "BC5"
201-
n = 5
202-
self.mode = "RGB"
203204
else:
204205
raise NotImplementedError(f"Unimplemented pixel format {repr(fourcc)}")
205206

0 commit comments

Comments
 (0)