当前位置:首页 > python > 正文内容

python 实现快速扣背景图功能

zhangsir3年前 (2023-01-06)python337

一,实现快速扣背景图需要rembg这个三方库

#引入rembg库
from rembg import remove
#素材
input_path = 'input.jpg'
#效果
output_path = 'output.jpg'
#打开素材图
with open(input_path, 'rb') as i:
    #打开效果图
    with open(output_path, 'wb') as o:
        #读取素材图数据
        input = i.read()
        #进行抠图处理
        output = remove(input)
        #写入数据
        o.write(output)


zhangsir版权c2防采集https://mianka.xyz

扫描二维码推送至手机访问。

版权声明:本文由zhangsir or zhangmaam发布,如需转载请注明出处。

本文链接:https://www.mianka.xyz/post/91.html

标签: python
分享给朋友:

“python 实现快速扣背景图功能” 的相关文章

python之seleniumwire获取network(网络)信息

python之seleniumwire获取请求头参数import time from seleniumwire import webdriver # 创建Chrome驱动程序的新实例 driver = webdriver...

Python三方库ddddocr实现验证码识别

Python三方库ddddocr实现验证码识别环境要求python >= 3.8安装三方库pip install ddddocr -i https://pypi.tuna.tsinghua.edu.cn/simple参数说明:参数名参数类型默认值说明us...

权大师商标查询api

''' data:2022-10-15 autor:zhangsir 权大师商标查询api ''' import requests import json import time import h...

python 给电脑设置闹钟

python会自动触发windows桌面通知,提示重要事项,比如说:您已工作两小时,该休息了我们可以设定固定时间提示,比如隔10分钟、1小时等用到的第三方库:win10toast - 用于发送桌面通知的工具from win10toast import ToastNoti...

python selenium 使用代理ip

代码如下:from selenium import webdriver chromeOptions = webdriver.ChromeOptions() chromeOptions.add_argument("--proxy-serv...

python Tesseract 验证码识别训练流程

1、用jTessBoxEditor把要训练样本图片文件合并成tif文件(样本图片一定要为有效的格式图片)点击顶栏的Tools选项,选择Merge TIFF..   进入你要训练的样本图片所在的目录,点击Ctrl+Alt+A,选择所有图片点击打开,然后保存文件名到指定目录,我这里保...