当前位置:网站首页>Who said you should know PS? This open-source artifact can also be pulled in batch, and the effect is outstanding!
Who said you should know PS? This open-source artifact can also be pulled in batch, and the effect is outstanding!
2022-04-23 11:19:00 【Brother dampness】
Reprint :https://blog.csdn.net/osfront/article/details/114692606
【 Introduction 】: An open source tool for quickly removing background images , After installation and configuration, it can be installed on the server 、 Batch operation of pictures in the command line .
brief introduction
rembg It's using Python Implement a tool for removing background images , requirement Python 3.8 Or later , Support batch operation , It's flexible to use , You can use the command line directly 、 Run as a service 、 stay docker Use in , It can also be called as a library .
Download and install
The source code address of the project is :
https://github.com/danielgatis/rembg
requirement Python 3.8 Or later , Use the following command to install :
pip install rembg
Easy to use
1、 Use on the command line
In the command line, you can edit the server image 、 Local image and the entire folder image operation , as follows :
(1) Operate on remote images :
curl -s http://input.png | rembg > output.png
(2) Operate on local images :
rembg -o path/to/output.png path/to/input.png
(3) Operate on the pictures in the whole folder :
rembg -p path/to/inputs
2、 Use as a service
(1) Start the service
rembg-server
(2) If the picture can be accessed by direct link , You can directly open the following address operation through the browser :
http://localhost:5000?url=http://image.png
You can also use HTML The form is operated by uploading a file :
<form action="http://localhost:5000" method="post" enctype="multipart/form-data">
<input type="file" name="file"/>
<input type="submit" value="upload"/>
</form>
1
2
3
3、 stay docker Use in
stay docker It's also very convenient to use , Run the following command directly :
curl -s http://input.png | docker run -i -v ~/.u2net:/root/.u2net danielgatis/rembg:latest > output.png
4、 Call as library
It's also easy to call directly in a script , First create app.py, The contents are as follows :
import sys
from rembg.bg import remove
sys.stdout.buffer.write(remove(sys.stdin.buffer.read()))
1
2
Run the command again :
cat input.png | python app.py > out.png
Project sample use effect :
Advanced use
Some pictures may use alpha matting Pattern ( That is to use -a -ae 15 Options ) The treatment effect will be more perfect , The order is as follows :
curl -s http://input.png | rembg -a -ae 15 > output.png
The effect comparison is as follows :
Conclusion
remgb That's all for a brief introduction , If you are interested in children's shoes, you can download and install them yourself , More details about , See the project home page .
Open source outpost Everyday sharing is hot 、 Interesting and practical open source projects . Participate in maintenance 10 ten thousand + Star Open source technology repository for , Include :Python、Java、C/C++、Go、JS、CSS、Node.js、PHP、.NET etc. .
版权声明
本文为[Brother dampness]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231115091312.html
边栏推荐
- 实践数据湖iceberg 第三十课 mysql->iceberg,不同客户端有时区问题
- Analysis on the characteristics of the official game economic model launched by platoffarm
- MySQL interview questions explain how to set hash index
- MIT:用无监督为世界上每个像素都打上标签!人类:再也不用为1小时视频花800个小时了
- MySQL对数据表已有表进行分区表的实现
- 微型机器人的认知和研发技术
- GPU, CUDA,cuDNN三者的关系总结
- 赛微微电科创板上市破发:跌幅达26% 公司市值44亿
- Detailed introduction to paging exploration of MySQL index optimization
- Using Baidu PaddlePaddle EasyDL to accomplish specified target recognition
猜你喜欢

Get things technology network optimization - CDN resource request Optimization Practice

解读机器人编程课程的生物认知度

Promise details

About the three commonly used auxiliary classes of JUC

CUMCM 2021-b: preparation of C4 olefins by ethanol coupling (2)

redis优化系列(二)Redis主从原理、主从常用配置

Microsoft Access database using PHP PDO ODBC sample

初探 Lambda Powertools TypeScript

PDMS soft lithography process

一道有趣的阿里面试题
随机推荐
AcWing 1874. 哞加密(枚举,哈希)
详解MySQL中timestamp和datetime时区问题导致做DTS遇到的坑
Learn go language 0x05: the exercise code of map in go language journey
MySQL failed to insert the datetime type field without single quotation marks
年度最尴尬的社死瞬间,是Siri给的
Mysql排序的特性详情
Which company is good for opening futures accounts? Who can recommend several safe and reliable futures companies?
An interesting interview question
学习 Go 语言 0x04:《Go 语言之旅》中切片的练习题代码
Learning go language 0x02: understanding slice
Canvas详解
CUMCM 2021-B:乙醇偶合制備C4烯烴(2)
GPU, CUDA,cuDNN三者的關系總結
MySQL8.0升级的踩坑历险记
Promise details
qt 64位静态版本显示gif
MySQL索引优化之分页探索详细介绍
Prevent SQL injection in web projects
MySQL Router重装后重新连接集群进行引导出现的——此主机中之前已配置过的问题
VM set up static virtual machine