Skip to content

Commit 7fb6683

Browse files
committed
initial
0 parents  commit 7fb6683

36 files changed

+1363
-0
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# https://editorconfig.org/
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 4
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
end_of_line = lf
11+
charset = utf-8

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# general things to ignore
2+
build/
3+
dist/
4+
*.egg-info/
5+
*.egg
6+
*.py[cod]
7+
__pycache__/
8+
*.so
9+
*~
10+
11+
# due to using tox and pytest
12+
.tox
13+
.cache

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Daniel Gatis
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
include pyproject.toml
2+
3+
# Include the README
4+
include *.md
5+
6+
# Include the license file
7+
include LICENSE.txt
8+
9+
# Include the data files
10+
recursive-include data *
11+
12+
include requirements.txt

README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
2+
# Rembg
3+
4+
Rembg is a tool to remove images background. That is it.
5+
6+
<p style="display: flex;align-items: center;justify-content: center;">
7+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/car-1.jpg" width="100" />
8+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/car-1.out.png" width="100" />
9+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/car-2.jpg" width="100" />
10+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/car-2.out.png" width="100" />
11+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/car-3.jpg" width="100" />
12+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/car-3.out.png" width="100" />
13+
</p>
14+
15+
<p style="display: flex;align-items: center;justify-content: center;">
16+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/animal-1.jpg" width="100" />
17+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/animal-1.out.png" width="100" />
18+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/animal-2.jpg" width="100" />
19+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/animal-2.out.png" width="100" />
20+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/animal-3.jpg" width="100" />
21+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/animal-3.out.png" width="100" />
22+
</p>
23+
24+
<p style="display: flex;align-items: center;justify-content: center;">
25+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/girl-1.jpg" width="100" />
26+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/girl-1.out.png" width="100" />
27+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/girl-2.jpg" width="100" />
28+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/girl-2.out.png" width="100" />
29+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/girl-3.jpg" width="100" />
30+
<img src="https://raw.githubusercontent.com/danielgatis/rembg/master/examples/girl-3.out.png" width="100" />
31+
</p>
32+
33+
### Installation
34+
35+
Install it from pypi
36+
37+
```bash
38+
pip install rembg
39+
```
40+
41+
### Usage as a cli
42+
43+
Remove the backaground from a remote image
44+
```bash
45+
curl -s http://input.png | rembg > output.png
46+
```
47+
48+
Remove the backaground from a local file
49+
```bash
50+
rembg -o path/to/output.png paht/to/input.png
51+
```
52+
53+
Remove the backaground from all images in a folder
54+
```bash
55+
rembg -p path/to/inputs
56+
```
57+
58+
### Usage as a server
59+
60+
Start the server
61+
```bash
62+
rembg-server
63+
```
64+
65+
Open your browser to
66+
```
67+
http://localhost:5000?url=http://image.png
68+
```
69+
70+
### Usage as a library
71+
72+
In `app.py`
73+
74+
```python
75+
import sys
76+
from rembg.bg import remove
77+
78+
sys.stdout.buffer.write(remove(sys.stdin.buffer.read()))
79+
80+
```
81+
82+
Then run
83+
```
84+
cat input.png | python app.py > out.png
85+
```
86+
87+
### References
88+
89+
- https://arxiv.org/pdf/2005.09007.pdf
90+
- https://github.com/NathanUA/U-2-Net
91+
92+
### License
93+
94+
Copyright (c) 2020-present [Daniel Gatis](https://github.com/danielgatis)
95+
96+
Licensed under [MIT License](./LICENSE.txt)

examples/animal-1.jpg

135 KB
Loading

examples/animal-1.out.png

397 KB
Loading

examples/animal-2.jpg

44.4 KB
Loading

examples/animal-2.out.png

174 KB
Loading

examples/animal-3.jpg

247 KB
Loading

0 commit comments

Comments
 (0)