Hi again.
I'd like to be able to save animated PNGs without Pillow merging the consecutive identical frames. As far as know, this is not cleanly possible with the current API.
Related (for GIFs):
I would like this feature for two reasons:
- I have dynamically generated APNGs that sometimes fail to
.save() because of this. It causes ValueError while the individual frame delays are correctly representable, but their sum is not (numerator exceeds 65535)
- I would like to preserve the original number of frames distinctly, as they are meaningful for my workflow when the APNG is reopened later for editing or studying. I would like the frames and their durations to be saved losslessly so that the process is reversible.
Here is a reproducible example regarding the first point (with pillow==12.3.0):
from PIL import Image
frame_a = Image.new("RGB", (1, 1), "green")
frame_b = Image.new("RGB", (1, 1), "red")
# ValueError: cannot write duration
frame_a.save(
"output.png",
format="PNG",
save_all=True,
append_images=[frame_b, frame_b],
duration=[100, 32768, 32769],
)
Would you please consider adding a save() option to help with these use cases?
Hi again.
I'd like to be able to save animated PNGs without Pillow merging the consecutive identical frames. As far as know, this is not cleanly possible with the current API.
Related (for GIFs):
I would like this feature for two reasons:
.save()because of this. It causesValueErrorwhile the individual frame delays are correctly representable, but their sum is not (numerator exceeds65535)Here is a reproducible example regarding the first point (with
pillow==12.3.0):Would you please consider adding a
save()option to help with these use cases?