Skip to content

Error when saving apng with save_all #7459

@Yay295

Description

@Yay295
from PIL import Image img = Image.open('num_plays.png') img.save('test.apng',save_all=True)

num_plays.png is in https://github.com/python-pillow/Pillow/tree/main/Tests/images/apng.

Traceback (most recent call last): File "<stdin>", line 1, in <module> File ".../.venv/Lib/site-packages/PIL/Image.py", line 2413, in save save_handler(self, fp, filename) File ".../.venv/Lib/site-packages/PIL/PngImagePlugin.py", line 1218, in _save_all _save(im, fp, filename, save_all=True) File ".../.venv/Lib/site-packages/PIL/PngImagePlugin.py", line 1241, in _save mode = modes.pop() ^^^^^^^^^^^ KeyError: 'pop from an empty set'

This error doesn't occur without save_all=True, but then it doesn't save all frames. Saving as a GIF works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions