热线电话:13121318867

登录
2019-02-14 阅读量: 985
如何批量导出python画的图形并切除白边?

问题描述:

如何批量导出python画的图形并切除白边呢?这样会很方便素材的整理,有助于提高报告制作的效率


解决方法:

  • 设置循环可以批量导出
  • 设置轴off+边距+bbox_inches='tight'可以切除白边
out=[new1,new2,new3,new4]

plt.axis('off')
plt.gca().xaxis.set_major_locator(plt.NullLocator())
plt.gca().yaxis.set_major_locator(plt.NullLocator())
plt.subplots_adjust(top=1,bottom=0,left=0,right=1,wspace=0,hspace=0)

for i in range(4):
io.imshow(out[i]),plt.axis('off')
plt.savefig('C:/Users/Administrator/Desktop/{}.jpg'.format(i+1),dpi=300,bbox_inches='tight')
  • 此外切除白边的方法还可以考虑PS的批处理功能

0.0000
3
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子