mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 17:54:32 +03:00
Changed TIFF saving to use single frame save if given a single frame image and an empty generator
This commit is contained in:
parent
bfaa0a1f07
commit
04d9ce29a9
|
@ -1784,14 +1784,14 @@ class AppendingTiffWriter:
|
||||||
def _save_all(im, fp, filename):
|
def _save_all(im, fp, filename):
|
||||||
encoderinfo = im.encoderinfo.copy()
|
encoderinfo = im.encoderinfo.copy()
|
||||||
encoderconfig = im.encoderconfig
|
encoderconfig = im.encoderconfig
|
||||||
append_images = encoderinfo.get("append_images", [])
|
append_images = list(encoderinfo.get("append_images", []))
|
||||||
if not hasattr(im, "n_frames") and not append_images:
|
if not hasattr(im, "n_frames") and not append_images:
|
||||||
return _save(im, fp, filename)
|
return _save(im, fp, filename)
|
||||||
|
|
||||||
cur_idx = im.tell()
|
cur_idx = im.tell()
|
||||||
try:
|
try:
|
||||||
with AppendingTiffWriter(fp) as tf:
|
with AppendingTiffWriter(fp) as tf:
|
||||||
for ims in itertools.chain([im], append_images):
|
for ims in [im]+append_images:
|
||||||
ims.encoderinfo = encoderinfo
|
ims.encoderinfo = encoderinfo
|
||||||
ims.encoderconfig = encoderconfig
|
ims.encoderconfig = encoderconfig
|
||||||
if not hasattr(ims, "n_frames"):
|
if not hasattr(ims, "n_frames"):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user