“Simpan Gif Python” Kode Jawaban

Buat gif dari gambar dalam 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\n" % item)

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

Simpan Gif Python

first_im.save('out.gif', save_all=True, append_images=list_im, duration=100, loop=0)
Friendly Frog

Jawaban yang mirip dengan “Simpan Gif Python”

Pertanyaan yang mirip dengan “Simpan Gif Python”

Lebih banyak jawaban terkait untuk “Simpan Gif Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya