mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 21:24:31 +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
|
||||
pfsize, pfflags, fourcc, bitcount = struct.unpack("<4I", header.read(16))
|
||||
masks = struct.unpack("<4I", header.read(16))
|
||||
n = 0
|
||||
rawmode = None
|
||||
if pfflags & DDPF.RGB:
|
||||
# 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)}
|
||||
if bitcount == 8:
|
||||
self._mode = "L"
|
||||
|
|
Loading…
Reference in New Issue
Block a user