赞
踩
这是我想去除水印的图片:
这是去除水印后的效果:
看得出来效果很明显
因为网站给的示例代码不是很完整,所以我在这里给出直接可以用的代码
- import requests
- import base64
-
- url = "https://api.textin.com/ai/service/v1/image/watermark_remove"
-
- header = {
- # 请登录后前往 “工作台-账号设置-开发者信息” 查看 x-ti-app-id
- "x-ti-app-id": "***",
- # 请登录后前往 “工作台-账号设置-开发者信息” 查看 x-ti-secret-code
- "x-ti-secret-code": "***",
- }
- # 自行修改图片的路径
- with open('kunkun.png', mode='rb') as f:
- image = f.read()
- f.close()
- result = requests.post(url, data=image, headers=header)
- image_base64 = result.json()['result']['image']
- image_data = base64.b64decode(image_base64)
- with open('out.png', mode='wb') as f:
- f.write(image_data)

其中x-ti-app-id和x-ti-secret-code在网站注册后会提供,而且注册后会赠送使用额度大家都可以去尝试一下
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。