python中使用plt保存图片时去掉图片白边的方法:
plt.savefig(str(i)+".png", bbox_inches="tight", pad_inches=0.0)
如果只有一张图片需要保存,可以写成
plt.savefig("1.png", bbox_inches="tight", pad_inches=0.0)
效果如下图(黑色部分为系统背景色,白色部分为图片):
python中使用plt保存图片时去掉图片白边的方法:
plt.savefig(str(i)+".png", bbox_inches="tight", pad_inches=0.0)
如果只有一张图片需要保存,可以写成
plt.savefig("1.png", bbox_inches="tight", pad_inches=0.0)
效果如下图(黑色部分为系统背景色,白色部分为图片):