使用 python 去除照片背景的方法

使用 python 去除照片背景的方法插图

使用 python 去除照片背景的方法

① 安装rembg与pillow库

② 运行如下python代码。输入与输出的图片地址自己修改。

from rembg import remove
from PIL import Image
input_path = ‘images.jpg’
output_path = ‘images.png’
inp = Image.open(input_path)
output = remove(inp)
output.save(output_path)

③ 运行程序即可获取去除背景的png图片。

 

  • 打赏
  • 分享
分享到...
使用 python 去除照片背景的方法插图1
请选择打赏方式
使用 python 去除照片背景的方法插图1
使用 python 去除照片背景的方法插图2 使用 python 去除照片背景的方法插图3
  • 微信
  • 支付宝
© 版权声明
THE END
喜欢就支持一下吧
点赞0赞赏 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容