Closed GoogleCodeExporter closed 9 years ago
Did you try to make images a list of numpy arrays?
Original comment by almar.klein@gmail.com
on 20 Aug 2013 at 5:49
I'm not sure... This is my exact 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)
Did I do anything wrong? How do I make it a list of numpy arrays?
Original comment by Wenzao...@gmail.com
on 20 Aug 2013 at 6:01
Now you have PIL images. That *should* work too. I usually use it with numpy
arrays though, so you could try that instead.
I don't know from the top of my hand how to turn a PIL image into a numpy
array, but it should be straightforward.
Also you could do:
images = [visvis.imread(image) for image in glob.glob("*.png")]
Original comment by almar.klein@gmail.com
on 20 Aug 2013 at 6:54
Thank you! I just tried visvis.imread(image), however I got the same error:
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
It seems like it's a problem with writeGif, not how the image was read.
Original comment by Wenzao...@gmail.com
on 20 Aug 2013 at 7:09
I uninstalled Pillow 2.1.0 and installed PIL 1.1.7, and it fixed the problem.
Original comment by Wenzao...@gmail.com
on 21 Aug 2013 at 8:04
Ahah! So probably they changed something in the API causing this problem...
Thanks for that.
(this code will probably be moved to imageio at some point, where freeimage
will be used to create the GIF, so I will mark this as not fixed for now)
Original comment by almar.klein@gmail.com
on 21 Aug 2013 at 8:11
Original issue reported on code.google.com by
Wenzao...@gmail.com
on 20 Aug 2013 at 5:05