2

写入图像文件时出现以下错误:

imageio.imwrite(fname,g);
File "C:\Users\Himanshu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\imageio\core\functions.py", line 261, in imwrite
writer.append_data(im)
....
....
raise IOError("encoder error %d when writing image file" % s)
OSError: encoder error -2 when writing image file

我正在编写代码的函数是:

def main():
for filename in os.listdir(path):
    ....
    ....
    g = numpy.reshape(a,(len(a)//width,width));
    g = numpy.uint8(g);
    fname = str(filename + '.jpg');
    imageio.imwrite(fname,g);

我是这方面的初学者,请帮助。

4

0 回答 0