mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-28 10:56:18 +03:00
Simplified save code
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
parent
9369a48457
commit
15c90ac9bb
|
@ -452,10 +452,8 @@ def _save(im, fp, filename):
|
|||
+ rgba_mask # dwRGBABitMask
|
||||
+ struct.pack("<IIIII", DDSCAPS.TEXTURE, 0, 0, 0, 0)
|
||||
)
|
||||
if im.mode == 'LA':
|
||||
ImageFile._save(im, fp, [Image.Tile("raw", (0, 0) + im.size, 0, ('LA', 0, 1))])
|
||||
else:
|
||||
ImageFile._save(im, fp, [Image.Tile("raw", (0, 0) + im.size, 0, (im.mode[::-1], 0, 1))])
|
||||
mode = "LA" if im.mode == "LA" else im.mode[::-1]
|
||||
ImageFile._save(im, fp, [Image.Tile("raw", (0, 0) + im.size, 0, (mode, 0, 1))])
|
||||
|
||||
|
||||
# fmt: on
|
||||
|
|
Loading…
Reference in New Issue
Block a user