Gerando um GIF animado em Python
Eu estou tentando gerar um GIF animado usando images2gif.py (pastebin para o mais recente verson: bit.ly/XMMn5h).
Eu estou usando este script Python:
__author__ = 'Robert'
from images2gif import writeGif
from PIL import Image
import os
file_names = sorted((fn for fn in os.listdir('.') if fn.endswith('.gif')))
#['animationframa.png', 'animationframb.png', ...] "
images = [Image.open(fn) for fn in file_names]
size = (150,150)
for im in images:
im.thumbnail(size, Image.ANTIALIAS)
print writeGif.__doc__
filename = "my_gif.GIF"
writeGif(filename, images, duration=0.2)
No entanto, estou recebendo o seguinte erro:
File "C:\Python27\lib\images2gif.py" , line 418, in writeGifToFile
globalPalette = palettes[ occur.index(max(occur)) ] ValueError: max()
arg is an empty sequence
Parece-me que ocorrer é vazio. O que está errado e existe uma maneira melhor?