Skip to content

Commit bd6c08f

Browse files
committed
uhoh
1 parent ae0c911 commit bd6c08f

12 files changed

+23
-6
lines changed

Tests/test_file_dds.py

+22-6
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,28 @@ def test_save(mode: str, test_file: str, tmp_path: Path) -> None:
399399

400400

401401
def test_save_dxt1(tmp_path: Path) -> None:
402-
out = str(tmp_path / "temp.dds")
403-
with Image.open("Tests/images/dxt1-rgb-4bbp-noalpha_MipMaps-1.dds") as im:
404-
im.save(out, pixel_format="DXT1")
402+
if False:
403+
out = str(tmp_path / "temp.dds")
404+
with Image.open("Tests/images/dxt1-rgb-4bbp-noalpha_MipMaps-1.dds") as im:
405+
im.save(out, pixel_format="DXT1")
405406

406-
with Image.open(out) as reloaded:
407-
assert_image_similar(im, reloaded, 1.84)
407+
with Image.open(out) as reloaded:
408+
assert_image_similar(im, reloaded, 1.84)
409+
410+
with Image.open("Tests/images/transparent.png") as im:
411+
im.convert("RGB").save("opaque.dds")
412+
Image.open("opaque.dds").save("opaque.png")
413+
for x in range(im.width):
414+
for y in range(im.height):
415+
pass#print(im.getpixel((x, y)))
416+
im.save("temp.gif")
417+
im.save("temp.dds", pixel_format="DXT1")
418+
Image.open("temp.dds").save("temp.png")
408419

409420
with Image.open("Tests/images/transparent.png") as im:
410-
im.save("temp.dds", pixel_format="DXT1")
421+
x = im.crop((120, 100, 124, 104))
422+
x.save("cropped.png")
423+
x.save("cropped.dds")
424+
Image.open("cropped.dds").save("roundtrip.png")
425+
x.convert("RGB").save("rgb.dds")
426+
Image.open("rgb.dds").save("rgb.png")

cropped.dds

192 Bytes
Binary file not shown.

cropped.png

136 Bytes
Loading

opaque.dds

88 KB
Binary file not shown.

opaque.png

20.6 KB
Loading

rgb.dds

176 Bytes
Binary file not shown.

rgb.png

120 Bytes
Loading

roundtrip.png

136 Bytes
Loading

src/libImaging/BcnEncode.c

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ ImagingBcnEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes) {
9595
}
9696

9797
if (transparency) {
98+
printf("transparency\n");
9899
*dst++ = color_min;
99100
*dst++ = color_min >> 8;
100101
}

temp.dds

15 KB
Binary file not shown.

temp.gif

7.74 KB
Loading

temp.png

15.6 KB
Loading

0 commit comments

Comments
 (0)