-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.
Description
Pillow/src/PIL/DdsImagePlugin.py
Lines 156 to 159 in 84fed4d
| elif dxgi_format == DXGI_FORMAT_BC7_UNORM_SRGB: | |
| self.pixel_format = "BC7" | |
| self.im_info["gamma"] = 1 / 2.2 | |
| n = 7 |
At self.im_info["gamma"] = 1 / 2.2, self.im_info has never been initialized and so trying to set self.im_info["gamma"] fails with:
AttributeError: 'DdsImageFile' object has no attribute 'im_info'
As far as I can tell, this is the only place im_info is ever referenced in this or the ancestor classes.
A possible solution would be to change this section to:
elif dxgi_format == DXGI_FORMAT_BC7_UNORM_SRGB:
self.pixel_format = "BC7"
if not hasattr(self, 'im_info'):
self.im_info = {}
self.im_info["gamma"] = 1 / 2.2
n = 7An alternate solution would be to initialize im_info earlier in the loader method.
Metadata
Metadata
Assignees
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.