mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-30 01:43:17 +03:00
Renamed idlen variable to id_len
This commit is contained in:
parent
325ca3cede
commit
a9d504e91d
|
@ -55,7 +55,7 @@ class TgaImageFile(ImageFile.ImageFile):
|
||||||
# process header
|
# process header
|
||||||
s = self.fp.read(18)
|
s = self.fp.read(18)
|
||||||
|
|
||||||
idlen = i8(s[0])
|
id_len = i8(s[0])
|
||||||
|
|
||||||
colormaptype = i8(s[1])
|
colormaptype = i8(s[1])
|
||||||
imagetype = i8(s[2])
|
imagetype = i8(s[2])
|
||||||
|
@ -102,8 +102,8 @@ class TgaImageFile(ImageFile.ImageFile):
|
||||||
if imagetype & 8:
|
if imagetype & 8:
|
||||||
self.info["compression"] = "tga_rle"
|
self.info["compression"] = "tga_rle"
|
||||||
|
|
||||||
if idlen:
|
if id_len:
|
||||||
self.info["id_section"] = self.fp.read(idlen)
|
self.info["id_section"] = self.fp.read(id_len)
|
||||||
|
|
||||||
if colormaptype:
|
if colormaptype:
|
||||||
# read palette
|
# read palette
|
||||||
|
@ -164,9 +164,9 @@ def _save(im, fp, filename):
|
||||||
|
|
||||||
id_section = im.encoderinfo.get("id_section",
|
id_section = im.encoderinfo.get("id_section",
|
||||||
im.info.get("id_section", ""))
|
im.info.get("id_section", ""))
|
||||||
idlen = len(id_section)
|
id_len = len(id_section)
|
||||||
if idlen > 255:
|
if id_len > 255:
|
||||||
idlen = 255
|
id_len = 255
|
||||||
id_section = id_section[:255]
|
id_section = id_section[:255]
|
||||||
warnings.warn("id_section has been trimmed to 255 characters")
|
warnings.warn("id_section has been trimmed to 255 characters")
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ def _save(im, fp, filename):
|
||||||
if orientation > 0:
|
if orientation > 0:
|
||||||
flags = flags | 0x20
|
flags = flags | 0x20
|
||||||
|
|
||||||
fp.write(o8(idlen) +
|
fp.write(o8(id_len) +
|
||||||
o8(colormaptype) +
|
o8(colormaptype) +
|
||||||
o8(imagetype) +
|
o8(imagetype) +
|
||||||
o16(colormapfirst) +
|
o16(colormapfirst) +
|
||||||
|
|
Loading…
Reference in New Issue
Block a user