Skip to content

Commit

Permalink
Document using encoderinfo on subsequent frames from python-pillow#8483
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Feb 27, 2025
1 parent d7d48df commit 3407f76
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2475,7 +2475,21 @@ def save(
format to use is determined from the filename extension.
If a file object was used instead of a filename, this
parameter should always be used.
:param params: Extra parameters to the image writer.
:param params: Extra parameters to the image writer. These can also be
set on the image itself through ``encoderinfo``. This is useful when
saving multiple images::
# Saving XMP data to a single image
from PIL import Image
red = Image.new("RGB", (1, 1), "#f00")
red.save("out.mpo", xmp=b"test")
# Saving XMP data to the second frame of an image
from PIL import Image
black = Image.new("RGB", (1, 1))
red = Image.new("RGB", (1, 1), "#f00")
red.encoderinfo = {"xmp": b"test"}
black.save("out.mpo", save_all=True, append_images=[red])
:returns: None
:exception ValueError: If the output format could not be determined
from the file name. Use the format option to solve this.
Expand Down

0 comments on commit 3407f76

Please sign in to comment.