Skip to content

Conversation

@radarhere
Copy link
Member

#8775 (comment) requests that save_all default to true if append_images is not empty.

So rather than requiring save_all in the tutorial example,

from PIL import Image

# List of image filenames
image_filenames = [
    "hopper.jpg",
    "rotated_hopper_270.jpg",
    "rotated_hopper_180.jpg",
    "rotated_hopper_90.jpg",
]

# Open images and create a list
images = [Image.open(filename) for filename in image_filenames]

# Save the images as an animated GIF
images[0].save(
    "animated_hopper.gif",
    save_all=True,
    append_images=images[1:],
    duration=500,  # duration of each frame in milliseconds
    loop=0,  # loop forever
)

users can just

images[0].save(
    "animated_hopper.gif",
    append_images=images[1:],
    duration=500,  # duration of each frame in milliseconds
    loop=0,  # loop forever
)

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you resolve the conflict?

@hugovk hugovk merged commit 10ccbd7 into python-pillow:main Mar 27, 2025
55 checks passed
@radarhere radarhere deleted the append_images branch March 27, 2025 21:09
radarhere added a commit to radarhere/Pillow that referenced this pull request Mar 29, 2025
radarhere added a commit to radarhere/Pillow that referenced this pull request Mar 29, 2025
hugovk pushed a commit that referenced this pull request Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants