mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-13 01:05:48 +03:00
Only set mode when necessary
This commit is contained in:
parent
769a14dca5
commit
ddb238c70d
|
@ -79,8 +79,6 @@ class FtexImageFile(ImageFile.ImageFile):
|
||||||
self._size = struct.unpack("<2i", self.fp.read(8))
|
self._size = struct.unpack("<2i", self.fp.read(8))
|
||||||
mipmap_count, format_count = 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.
|
# Only support single-format files.
|
||||||
# I don't know of any multi-format file.
|
# I don't know of any multi-format file.
|
||||||
assert format_count == 1
|
assert format_count == 1
|
||||||
|
@ -95,6 +93,7 @@ class FtexImageFile(ImageFile.ImageFile):
|
||||||
self._mode = "RGBA"
|
self._mode = "RGBA"
|
||||||
self.tile = [ImageFile._Tile("bcn", (0, 0) + self.size, 0, (1,))]
|
self.tile = [ImageFile._Tile("bcn", (0, 0) + self.size, 0, (1,))]
|
||||||
elif format == Format.UNCOMPRESSED:
|
elif format == Format.UNCOMPRESSED:
|
||||||
|
self._mode = "RGB"
|
||||||
self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, "RGB")]
|
self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, "RGB")]
|
||||||
else:
|
else:
|
||||||
msg = f"Invalid texture compression format: {repr(format)}"
|
msg = f"Invalid texture compression format: {repr(format)}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user