I am experiencing errors with using images2gif on python3.5.2.
I have already experienced a few issues which I found answers for, but havent seen this problem documented anywhere.
Code:
from PIL import Image
from images2gif import writeGif
import urllib.request
image_files=["list of png image files in the same directory as the script"]
images = [Image.open(fn) for fn in image_files]
gif_file = "test-gif.GIF"
writeGif(gif_file, images, duration=44)
Error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-19-75192c4aeed1> in <module>()
7
8 gif_file = "test-gif.GIF"
----> 9 writeGif(gif_file, images, duration=44)
C:\Users\mchoy2\AppData\Local\Continuum\Anaconda3\lib\site-packages\images2gif\images2gif.py in writeGif(filename, images, duration, repeat, dither, nq, subRectangles, dispose)
591 fp = open(filename, 'wb')
592 try:
--> 593 gifWriter.writeGifToFile(fp, images, duration, loops, xy, dispose)
594 finally:
595 fp.close()
C:\Users\mchoy2\AppData\Local\Continuum\Anaconda3\lib\site-packages\images2gif\images2gif.py in writeGifToFile(self, fp, images, durations, loops, xys, disposes)
446
447 # Write
--> 448 fp.write(header)
449 fp.write(globalPalette)
450 fp.write(appext)
TypeError: a bytes-like object is required, not 'str'
Edit: Updated with full error message
显示错误消息,因为images2gif是为python 2.x而不是3.x
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.