如何将 StringIO 与 imghdr 一起使用来确定图像是否有效
我将图像加载到
image_file = StringIO(open("test.gif",'rb').read())
imghdr.what(image_file.getvalue())
print imghdr.what(image_file.getvalue())
File "/usr/lib/python2.7/imghdr.py", line 12, in what
f = open(file, 'rb')
TypeError: file() argument 1 must be encoded string without NULL bytes, not str