Error creating GIF using images2gif.py

I am trying to create a GIF file using images2fig.py from the visvis package

With this very simple code:

import glob from PIL import Image from visvis.vvmovie.images2gif import writeGif images = [Image.open(image) for image in glob.glob("*.png")] filename = "test.gif" writeGif(filename, images, duration=0.2) 

I got an error message

  File "C:\Python27\lib\site-packages\visvis\vvmovie\images2gif.py", line 575, in writeGif gifWriter.writeGifToFile(fp, images, duration, loops, xy, dispose) File "C:\Python27\lib\site-packages\visvis\vvmovie\images2gif.py", line 436, in writeGifToFile fp.write(globalPalette) TypeError: must be string or buffer, not list 

How to fix it?

I use Python 2.7.5, Pillow 2.1.0, numpy 1.7.1-2, all this is a standard installation from Python (x, y) 2.7.5 on Windows and visvis 1.8, which is the latest version. I tried reinstalling the packages, but that did not help. I still get the same error. My friend also reproduced the error on his computer.

0
source share
1 answer

@korylprince I fixed the problem with the following two changes:

  • I uninstalled Python (x, y), installed Anaconda (32-bit), then installed visvis via pip.

  • Instead of a PIL image, I now use imread(image) , which loads the image into a numpy array.

On another computer, I did not uninstall Python (x, y), instead I uninstalled Pillow 2.1.0 and installed PIL 1.1.7 , and also replaced the code with the same one as in step 2 above. So he worked with Python (x, y). So the problem is Pillow 2.1.0 .

+1
source

Source: https://habr.com/ru/post/1497895/


All Articles