mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
The 'Name: ' field must be less than length 100
This commit is contained in:
parent
eb2d6560a4
commit
85e06057e2
|
@ -347,7 +347,11 @@ def _save(im, fp, filename):
|
|||
|
||||
fp.write(("Image type: %s image\r\n" % image_type).encode("ascii"))
|
||||
if filename:
|
||||
fp.write(("Name: %s\r\n" % filename).encode("ascii"))
|
||||
# Each line must be under length 100, or: SyntaxError("not an IM file")
|
||||
name_format = "Name: %s\r\n"
|
||||
max = 100 - len(name_format % "")
|
||||
# Keep the last part of the string, will hold the filename.ext
|
||||
fp.write((name_format % filename[-max:]).encode("ascii"))
|
||||
fp.write(("Image size (x*y): %d*%d\r\n" % im.size).encode("ascii"))
|
||||
fp.write(("File size (no of images): %d\r\n" % frames).encode("ascii"))
|
||||
if im.mode in ["P", "PA"]:
|
||||
|
|
Loading…
Reference in New Issue
Block a user