Passing `duration` or `fps` has no effect on the output GIF using PillowPlugin
See original GitHub issueimport imageio.v3 as iio
import matplotlib.pyplot as plt
gif_path = "test.gif"
frames_path = "{i}.jpg"
n = 20
plt.figure(figsize=(4,4))
for x in range(n):
plt.scatter(x/n, x/n)
plt.xlim(0, 1)
plt.ylim(0, 1)
plt.savefig(f"{x}.jpg")
frames = np.stack(
[iio.imread(f"{i}.jpg") for i in range(n)],
axis=0
)
iio.imwrite(gif_path, frames, fps=1, loop=0)
I’ve tried duration=1000
too
Issue Analytics
- State:
- Created a year ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
imageio.plugins.pillow_legacy — imageio 2.22.4 documentation
(Only available in GIF-PIL) The number of frames per second. If duration is not given, the duration for each frame is set to...
Read more >imageio/pillow_legacy.py at master - GitHub
(Only available in GIF-PIL). The number of frames per second. If duration is not given, the. duration for each frame is set to...
Read more >Get frames per second of a gif in python? - Stack Overflow
In GIF files, each frame has its own duration. So there is no general fps for a GIF file. The way PIL supports...
Read more >imageio Documentation - Read the Docs
When creating a GIF using imageio the resulting images can get quite heavy, as the created GIF is not optimized. This can be...
Read more >How to create animated GIF with Pillow in Python - nkmk note
This article describes how to create an animated GIF with Pillow in Python.How to make GIF from images with Image.save() Sample code to ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Of course I can. It would live in
PillowPlugin.write
.The way it works under the hood is that
imopen
selects the plugin, instantiates it, and returns it (a typical factory).imwrite
callsimopen
internally to figure out the plugin to use and then callsplugin.write
to do the actual writing.No, I think you got that one right. The old pillow plugin added
fps
on top of pillow’s nativeduration
. I didn’t port that addition into the newPillowPlugin
because it is redundant. It is also more limiting becauseduration
allows an iterable with one duration per frame whereas something likefps=[1, 1/50, 1/25, 1/25]
seems a bit odd.That said, I see how
fps
seems like the more intuitive keyword compared toduration
so we could reintroduce it as a thin wrapper around (and coexistant with)duration
. (Subject to resolving the above odd edge case) What do you think?