一,实现快速扣背景图需要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)