Skip to content

Commit

Permalink
Only set mode when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Feb 19, 2025
1 parent 769a14d commit ddb238c
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 ddb238c

Please sign in to comment.