赞
踩
本节主要讲的是利用python实现PS抠图,是PS小白的福利,只要你一运行python代码,就能够立刻为你完美的抠图
绝对是又有技术含量,又可以装逼的,通过技术证明自己,岂不美哉
话不多说,上代码
from removebg import RemoveBg
import requests
import os
if __name__ == '__main__':
path = '%s\picture'%os.getcwd()
ispath = os.path.exists(path)
if not ispath:
os.mkdir(path)
response = requests.post(
'https://api.remove.bg/v1.0/removebg',
files={'image_file': open(path+'/juqiamyi.jpg', 'rb')},
# data={'size': 'auto','bg_color':'FFB6C1'},
data={'size': 'auto'},
headers={'X-Api-Key': '****YOU API KEY****'},
)
if response.status_code == requests.codes.ok:
with open(path+'/juqiamyi.png', 'wb') as out:
out.write(response.content)
else:
print("Error:", response.status_code, response.text)
希望能够给到大家启发
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。