mirror of
https://git.mirrors.martin98.com/https://github.com/danielgatis/rembg
synced 2025-08-15 13:35:55 +08:00
Update README.md
This commit is contained in:
parent
d14a7b33f3
commit
308ac8b169
32
README.md
32
README.md
@ -43,44 +43,44 @@ Rembg is a tool to remove images background. That is it.
|
|||||||
Install it from pypi
|
Install it from pypi
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install rembg
|
pip install rembg
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage as a cli
|
### Usage as a cli
|
||||||
|
|
||||||
Remove the background from a remote image
|
Remove the background from a remote image
|
||||||
```bash
|
```bash
|
||||||
curl -s http://input.png | rembg > output.png
|
curl -s http://input.png | rembg > output.png
|
||||||
```
|
```
|
||||||
|
|
||||||
Remove the background from a local file
|
Remove the background from a local file
|
||||||
```bash
|
```bash
|
||||||
rembg -o path/to/output.png path/to/input.png
|
rembg -o path/to/output.png path/to/input.png
|
||||||
```
|
```
|
||||||
|
|
||||||
Remove the background from all images in a folder
|
Remove the background from all images in a folder
|
||||||
```bash
|
```bash
|
||||||
rembg -p path/to/inputs
|
rembg -p path/to/inputs
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage as a server
|
### Usage as a server
|
||||||
|
|
||||||
Start the server
|
Start the server
|
||||||
```bash
|
```bash
|
||||||
rembg-server
|
rembg-server
|
||||||
```
|
```
|
||||||
|
|
||||||
Open your browser to
|
Open your browser to
|
||||||
```
|
```
|
||||||
http://localhost:5000?url=http://image.png
|
http://localhost:5000?url=http://image.png
|
||||||
```
|
```
|
||||||
|
|
||||||
Also you can send the file as a FormData (multipart/form-data):
|
Also you can send the file as a FormData (multipart/form-data):
|
||||||
```
|
```
|
||||||
<form action="http://localhost:5000" method="post" enctype="multipart/form-data">
|
<form action="http://localhost:5000" method="post" enctype="multipart/form-data">
|
||||||
<input type="file" name="file"/>
|
<input type="file" name="file"/>
|
||||||
<input type="submit" value="upload"/>
|
<input type="submit" value="upload"/>
|
||||||
</form>
|
</form>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage as a library
|
### Usage as a library
|
||||||
@ -88,15 +88,15 @@ Also you can send the file as a FormData (multipart/form-data):
|
|||||||
In `app.py`
|
In `app.py`
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import sys
|
import sys
|
||||||
from rembg.bg import remove
|
from rembg.bg import remove
|
||||||
|
|
||||||
sys.stdout.buffer.write(remove(sys.stdin.buffer.read()))
|
sys.stdout.buffer.write(remove(sys.stdin.buffer.read()))
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run
|
Then run
|
||||||
```
|
```
|
||||||
cat input.png | python app.py > out.png
|
cat input.png | python app.py > out.png
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage as a docker
|
### Usage as a docker
|
||||||
@ -104,14 +104,14 @@ Then run
|
|||||||
Just run
|
Just run
|
||||||
|
|
||||||
```
|
```
|
||||||
curl -s http://input.png | docker run -i -v ~/.u2net:/root/.u2net danielgatis/rembg:latest > output.png
|
curl -s http://input.png | docker run -i -v ~/.u2net:/root/.u2net danielgatis/rembg:latest > output.png
|
||||||
```
|
```
|
||||||
|
|
||||||
### Advance usage
|
### Advance usage
|
||||||
|
|
||||||
Sometimes it is possible to achieve better results by turning on alpha matting. Example:
|
Sometimes it is possible to achieve better results by turning on alpha matting. Example:
|
||||||
```bash
|
```bash
|
||||||
curl -s http://input.png | rembg -a -ae 15 > output.png
|
curl -s http://input.png | rembg -a -ae 15 > output.png
|
||||||
```
|
```
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user