mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-12 09:12:22 +03:00
Convert to RGBA for low-res DXT1
This commit is contained in:
parent
766f60e8b2
commit
99f8d8ff39
|
@ -307,7 +307,7 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
|
||||||
|
|
||||||
mipmap_count = _get_mipmap_count(width, height) if generate_mips else 0
|
mipmap_count = _get_mipmap_count(width, height) if generate_mips else 0
|
||||||
|
|
||||||
thumb = im.convert("RGB")
|
thumb = im.convert("RGBA")
|
||||||
thumb.thumbnail((min(16, width), min(16, height)))
|
thumb.thumbnail((min(16, width), min(16, height)))
|
||||||
thumb = thumb.resize((_closest_power(thumb.width), _closest_power(thumb.height)))
|
thumb = thumb.resize((_closest_power(thumb.width), _closest_power(thumb.height)))
|
||||||
|
|
||||||
|
@ -368,9 +368,9 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
|
||||||
|
|
||||||
|
|
||||||
def _accept(prefix: bytes) -> bool:
|
def _accept(prefix: bytes) -> bool:
|
||||||
valid_header = prefix.startswith(b"VTF\x00")
|
if not prefix.startswith(b"VTF\x00"):
|
||||||
valid_version = struct.unpack_from("<2I", prefix, 4) >= (7, 0)
|
return False
|
||||||
return valid_header and valid_version
|
return struct.unpack_from("<2I", prefix, 4) >= (7, 0)
|
||||||
|
|
||||||
|
|
||||||
Image.register_open(VtfImageFile.format, VtfImageFile, _accept)
|
Image.register_open(VtfImageFile.format, VtfImageFile, _accept)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user