Simplified code

This commit is contained in:
Andrew Murray 2022-08-13 19:46:46 +10:00
parent 99e401123b
commit 5d4fbdfab4

View File

@ -194,9 +194,9 @@ def _save(im, fp, filename):
if colormaptype: if colormaptype:
palette = im.im.getpalette("RGB", "BGR") palette = im.im.getpalette("RGB", "BGR")
colormapfirst, colormaplength, colormapentry = 0, len(palette) // 3, 24 colormaplength, colormapentry = len(palette) // 3, 24
else: else:
colormapfirst, colormaplength, colormapentry = 0, 0, 0 colormaplength, colormapentry = 0, 0
if im.mode in ("LA", "RGBA"): if im.mode in ("LA", "RGBA"):
flags = 8 flags = 8
@ -211,7 +211,7 @@ def _save(im, fp, filename):
o8(id_len) o8(id_len)
+ o8(colormaptype) + o8(colormaptype)
+ o8(imagetype) + o8(imagetype)
+ o16(colormapfirst) + o16(0) # colormapfirst
+ o16(colormaplength) + o16(colormaplength)
+ o8(colormapentry) + o8(colormapentry)
+ o16(0) + o16(0)