mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-02 12:13:26 +03:00
Merge 8de6ad889c
into 5a04b9581b
This commit is contained in:
commit
940436ca9b
|
@ -697,15 +697,19 @@ class TestFileTiff:
|
|||
im = hopper()
|
||||
im2 = Image.new("L", (128, 128))
|
||||
im2.encoderinfo = {"tiffinfo": {278: 256}}
|
||||
im.save(outfile, save_all=True, append_images=[im2])
|
||||
im3 = Image.new("L", (128, 128))
|
||||
im.save(outfile, save_all=True, append_images=[im2, im3], tiffinfo={278: 512})
|
||||
|
||||
with Image.open(outfile) as im:
|
||||
assert isinstance(im, TiffImagePlugin.TiffImageFile)
|
||||
assert im.tag_v2[278] == 128
|
||||
assert im.tag_v2[278] == 512
|
||||
|
||||
im.seek(1)
|
||||
assert im.tag_v2[278] == 256
|
||||
|
||||
im.seek(2)
|
||||
assert im.tag_v2[278] == 512
|
||||
|
||||
def test_strip_raw(self) -> None:
|
||||
infile = "Tests/images/tiff_strip_raw.tif"
|
||||
with Image.open(infile) as im:
|
||||
|
|
|
@ -2302,7 +2302,9 @@ class AppendingTiffWriter(io.BytesIO):
|
|||
|
||||
|
||||
def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
|
||||
append_images = list(im.encoderinfo.get("append_images", []))
|
||||
encoderinfo = im.encoderinfo.copy()
|
||||
encoderconfig = im.encoderconfig
|
||||
append_images = list(encoderinfo.get("append_images", []))
|
||||
if not hasattr(im, "n_frames") and not append_images:
|
||||
return _save(im, fp, filename)
|
||||
|
||||
|
@ -2311,9 +2313,9 @@ def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
|
|||
with AppendingTiffWriter(fp) as tf:
|
||||
for ims in [im] + append_images:
|
||||
if not hasattr(ims, "encoderinfo"):
|
||||
ims.encoderinfo = {}
|
||||
ims.encoderinfo = encoderinfo
|
||||
if not hasattr(ims, "encoderconfig"):
|
||||
ims.encoderconfig = ()
|
||||
ims.encoderconfig = encoderconfig
|
||||
nfr = getattr(ims, "n_frames", 1)
|
||||
|
||||
for idx in range(nfr):
|
||||
|
|
Loading…
Reference in New Issue
Block a user