[英]matplotlib.image.imsave TypeError: Image data cannot be converted to float
Simplest fail case: 最简单的失败案例:
import matplotlib.image as mpimg
path = 'test_images/input.jpg'
temp = mpimg.imread(path)
mpimg.imsave(temp, 'output.jpg')
I get: 我得到:
line 1347, in imsave
image.set_data(arr)
File "/Users/chris/anaconda3/lib/python3.5/site-packages/matplotlib/image.py",
line 600, in set_data
raise TypeError("Image data cannot be converted to float")
I have tested that the file exists (putting the above code in a if os.path.isfile(path): test) and printed the temp.shape which gives me the expected results. 我已经测试了文件是否存在(将上面的代码放入if os.path.isfile(path):test中),并打印了temp.shape,它给了我预期的结果。 Be grateful for any assistance. 感谢您的协助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.