Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

make a gif with images python

import imageio
with imageio.get_writer('/path/to/movie.gif', mode='I') as writer:
    for filename in filenames:
        image = imageio.imread(filename)
        writer.append_data(image)
Comment

make gif from images in python

import glob
import os

gif_name = 'outputName'
file_list = glob.glob('*.png') # Get all the pngs in the current directory
list.sort(file_list, key=lambda x: int(x.split('_')[1].split('.png')[0])) # Sort the images by #, this may need to be tweaked for your use case

with open('image_list.txt', 'w') as file:
    for item in file_list:
        file.write("%s
" % item)

os.system('convert @image_list.txt {}.gif'.format(gif_name)) # On windows convert is 'magick'
Comment

PREVIOUS NEXT
Code Example
Python :: read a file with pandas 
Python :: throw error in python 
Python :: How to efficiently calculate the nth Catalan number, in Python? 
Python :: python open file for reading and writing 
Python :: webscrapping with python 
Python :: python print trailing zeros 
Python :: df size 
Python :: python write text file on the next line 
Python :: python count occurrences of an item in a list 
Python :: how to label points in scatter plot in python 
Python :: pytorch transpose 
Python :: fillna method 
Python :: how to convert pdf to word using python 
Python :: float infinity python 
Python :: group by in ruby mongoid 
Python :: python3 shebang line 
Python :: pygame get keypress code 
Python :: python turtle spiral 
Python :: python pillow cut image in half 
Python :: colors in scatter plot python 
Python :: how to make python open a program/desktop app 
Python :: pow python 
Python :: is python good for web development 
Python :: pydrive upload file to folder 
Python :: median of array python 
Python :: compute condition number python 
Python :: assign a same value to 2 variables at once python 
Python :: geopandas legend location 
Python :: group by, aggregate multiple column -pandas 
Python :: how to sort dict by value 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =