Monday, July 18, 2022

[FIXED] How can I take an existing animated GIF and make it play only once?

Issue

I'm relatively new to Python. I have a large group of animated gif files which I need to change from looping forever, to playing only once. Since I already know how to perform operations on multiple files using Python I'm halfway there.

So, is there a way to read the gif, change its setting and then save it?

I'm using python 3 FYI.

EDIT: Umm, if I did something wrong, please respond to let me know. Downvoting me into oblivion doesn't help me.


Solution

Check out Pillow and the documentation in its parent library, PIL. Whether a GIF repeats is configured through the Image.info['loop'] property.



Answered By - lyschoening
Answer Checked By - Terry (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.