Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DdsImagePlugin fails when dxgi_format == DXGI_FORMAT_BC7_UNORM_SRGB #4164

@ouroborus

Description

@ouroborus

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 = 7

An alternate solution would be to initialize im_info earlier in the loader method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugAny unexpected behavior, until confirmed feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions