mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-04-26 20:13:40 +03:00
Only unpack masks when necessary
This commit is contained in:
parent
5fd3035362
commit
8814610635
|
@ -345,11 +345,11 @@ class DdsImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
# pixel format
|
# pixel format
|
||||||
pfsize, pfflags, fourcc, bitcount = struct.unpack("<4I", header.read(16))
|
pfsize, pfflags, fourcc, bitcount = struct.unpack("<4I", header.read(16))
|
||||||
masks = struct.unpack("<4I", header.read(16))
|
|
||||||
n = 0
|
n = 0
|
||||||
rawmode = None
|
rawmode = None
|
||||||
if pfflags & DDPF.RGB:
|
if pfflags & DDPF.RGB:
|
||||||
# Texture contains uncompressed RGB data
|
# Texture contains uncompressed RGB data
|
||||||
|
masks = struct.unpack("<4I", header.read(16))
|
||||||
masks = {mask: ["R", "G", "B", "A"][i] for i, mask in enumerate(masks)}
|
masks = {mask: ["R", "G", "B", "A"][i] for i, mask in enumerate(masks)}
|
||||||
if bitcount == 8:
|
if bitcount == 8:
|
||||||
self._mode = "L"
|
self._mode = "L"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user