Skip to content

Commit

Permalink
Merge pull request #8767 from radarhere/ftex
Browse files Browse the repository at this point in the history
Only set mode when necessary in FtexImagePlugin
  • Loading branch information
hugovk authored Mar 3, 2025
2 parents 952d6e9 + ddb238c commit 7145057
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/PIL/FtexImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ def _open(self) -> None:
self._size = struct.unpack("<2i", self.fp.read(8))
mipmap_count, format_count = struct.unpack("<2i", self.fp.read(8))

self._mode = "RGB"

# Only support single-format files.
# I don't know of any multi-format file.
assert format_count == 1
Expand All @@ -95,6 +93,7 @@ def _open(self) -> None:
self._mode = "RGBA"
self.tile = [ImageFile._Tile("bcn", (0, 0) + self.size, 0, (1,))]
elif format == Format.UNCOMPRESSED:
self._mode = "RGB"
self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, "RGB")]
else:
msg = f"Invalid texture compression format: {repr(format)}"
Expand Down

0 comments on commit 7145057

Please sign in to comment.