mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-14 05:36:48 +03:00
Corrected DdsImagePlugin setting info gamma
This commit is contained in:
parent
bb1fc75e55
commit
d716278d20
BIN
Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.dds
Normal file
BIN
Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.dds
Normal file
Binary file not shown.
BIN
Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.png
Normal file
BIN
Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 B |
|
@ -8,6 +8,7 @@ TEST_FILE_DXT1 = "Tests/images/dxt1-rgb-4bbp-noalpha_MipMaps-1.dds"
|
||||||
TEST_FILE_DXT3 = "Tests/images/dxt3-argb-8bbp-explicitalpha_MipMaps-1.dds"
|
TEST_FILE_DXT3 = "Tests/images/dxt3-argb-8bbp-explicitalpha_MipMaps-1.dds"
|
||||||
TEST_FILE_DXT5 = "Tests/images/dxt5-argb-8bbp-interpolatedalpha_MipMaps-1.dds"
|
TEST_FILE_DXT5 = "Tests/images/dxt5-argb-8bbp-interpolatedalpha_MipMaps-1.dds"
|
||||||
TEST_FILE_DX10_BC7 = "Tests/images/bc7-argb-8bpp_MipMaps-1.dds"
|
TEST_FILE_DX10_BC7 = "Tests/images/bc7-argb-8bpp_MipMaps-1.dds"
|
||||||
|
TEST_FILE_DX10_BC7_UNORM_SRGB = "Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.dds"
|
||||||
TEST_FILE_UNCOMPRESSED_RGB = "Tests/images/uncompressed_rgb.dds"
|
TEST_FILE_UNCOMPRESSED_RGB = "Tests/images/uncompressed_rgb.dds"
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,6 +70,21 @@ class TestFileDds(PillowTestCase):
|
||||||
|
|
||||||
self.assert_image_equal(target, im)
|
self.assert_image_equal(target, im)
|
||||||
|
|
||||||
|
def test_dx10_bc7_unorm_srgb(self):
|
||||||
|
"""Check DX10 unsigned normalized integer images can be opened"""
|
||||||
|
|
||||||
|
target = Image.open(TEST_FILE_DX10_BC7_UNORM_SRGB.replace(".dds", ".png"))
|
||||||
|
|
||||||
|
im = Image.open(TEST_FILE_DX10_BC7_UNORM_SRGB)
|
||||||
|
im.load()
|
||||||
|
|
||||||
|
self.assertEqual(im.format, "DDS")
|
||||||
|
self.assertEqual(im.mode, "RGBA")
|
||||||
|
self.assertEqual(im.size, (16, 16))
|
||||||
|
self.assertEqual(im.info["gamma"], 1 / 2.2)
|
||||||
|
|
||||||
|
self.assert_image_equal(target, im)
|
||||||
|
|
||||||
def test_unimplemented_dxgi_format(self):
|
def test_unimplemented_dxgi_format(self):
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
NotImplementedError,
|
NotImplementedError,
|
||||||
|
|
|
@ -155,7 +155,7 @@ class DdsImageFile(ImageFile.ImageFile):
|
||||||
n = 7
|
n = 7
|
||||||
elif dxgi_format == DXGI_FORMAT_BC7_UNORM_SRGB:
|
elif dxgi_format == DXGI_FORMAT_BC7_UNORM_SRGB:
|
||||||
self.pixel_format = "BC7"
|
self.pixel_format = "BC7"
|
||||||
self.im_info["gamma"] = 1 / 2.2
|
self.info["gamma"] = 1 / 2.2
|
||||||
n = 7
|
n = 7
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError(
|
raise NotImplementedError(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user