I have the following code to generate GIFs from images, the code works fine and the gif is saved locally, what I want to do rather the saving the GIF locally, I want for example data URI that I could return to my project using a request. How can I generate the GIF and return it without saving it?
my code to generate the GIF
import os
import imageio as iio
import imageio
png_dir='./'
images=[]
for file_name in url:
images.append(file_name)
imageio.imwrite('movie.gif', images, format='gif')
I found I can save it as bytes with the following code
it will save the GIF as bytes then you can encode it.
for more examples check this out https://imageio.readthedocs.io/en/stable/examples.html#read-from-fancy-sources