当前位置:网站首页>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
边栏推荐
- More reliable model art than deep learning
- Common parameters of ffmpeg command line
- Solve the problem of "suncertpathbuilderexception: unable to find valid certification path to requested target"
- Detailed explanation of writing sequence and execution sequence of MySQL series SQL query statements
- Three web components (servlet, filter, listener)
- 进程间通信 -- 消息队列
- FileProvider 路径配置策略的理解
- Which company is good for opening futures accounts? Who can recommend several safe and reliable futures companies?
- @valid,@Validated 的学习笔记
- SVN的使用:
猜你喜欢
微型机器人的认知和研发技术
Write console script by laravel
After the MySQL router is reinstalled, it reconnects to the cluster for boot - a problem that has been configured in this host before
实践数据湖iceberg 第三十课 mysql->iceberg,不同客户端有时区问题
CUMCM 2021-b: preparation of C4 olefins by ethanol coupling (2)
Share two practical shell scripts
Redis optimization series (II) redis master-slave principle and master-slave common configuration
进程间通信 -- 消息队列
Canvas详解
得物技术网络优化-CDN资源请求优化实践
随机推荐
How to quickly query 10 million pieces of data in MySQL
赛微微电科创板上市破发:跌幅达26% 公司市值44亿
Get things technology network optimization - CDN resource request Optimization Practice
Facing the global market, platefarm today logs in to four major global platforms such as Huobi
C#的学习笔记【八】SQL【一】
MySQL failed to insert the datetime type field without single quotation marks
采用百度飞桨EasyDL完成指定目标识别
MySQL sorting feature details
QT 怎么把QWigdet变成QDialog
Go interface usage
When the activity is in progress! Click the link to join the live studio to participate in "can AI really save energy?" Let's have a discussion!
Microsoft Access database using PHP PDO ODBC sample
学习 Go 语言 0x02:对切片 Slice 的理解
stylecloud ,wordcloud 库学习及使用例子
MySQL interview questions explain how to set hash index
Use of SVN:
oh-my-lotto
mysql分表之后如何平滑上线详解
On lambda powertools typescript
Explain in detail the pitfalls encountered in DTS due to the time zone problems of timestamp and datetime in MySQL