最近,我尝试使用pyplot.savefig()命令(从matplotlib导入)在Spyder中保存图像,但它不起作用:
例如:代码:
filename = 'myImage.png'
#images contain the image shown in the Spyder Plots pane
pyplot.imshow(images)
pyplot.savefig(filename)我知道绘图窗格有一个Save按钮,但我想以编程方式保存映像(使用Python)。
请给我建议。
谢谢!
发布于 2021-01-14 13:23:26
使用plt.imsave()保存图像。以下是代码:
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img = mpimg.imread('test.png')
plt.imshow(img)
plt.imsave("myImage.png", img)
plt.show()https://stackoverflow.com/questions/65713791
复制相似问题