All Projects → danielgatis → Rembg

danielgatis / Rembg

Licence: mit
Rembg is a tool to remove images background.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Rembg

Spark Edge Detection
Edge detection in Spark AR
Stars: ✭ 13 (-98.65%)
Mutual labels:  image-processing
Ngmix
Gaussian mixtures and image processing implemented in python
Stars: ✭ 27 (-97.2%)
Mutual labels:  image-processing
Graph Based Image Segmentation
Implementation of efficient graph-based image segmentation as proposed by Felzenswalb and Huttenlocher [1] that can be used to generate oversegmentations.
Stars: ✭ 31 (-96.78%)
Mutual labels:  image-processing
Playpixels
Swift Playground Book for learning image processing.
Stars: ✭ 14 (-98.55%)
Mutual labels:  image-processing
Metalpetal
A GPU accelerated image and video processing framework built on Metal.
Stars: ✭ 907 (-5.91%)
Mutual labels:  image-processing
Deep learning projects
Stars: ✭ 28 (-97.1%)
Mutual labels:  image-processing
Compositor Api
Compositor is a lightweight utility API for compositing images quickly and efficiently in Unity.
Stars: ✭ 9 (-99.07%)
Mutual labels:  image-processing
Geemap
A Python package for interactive mapping with Google Earth Engine, ipyleaflet, and folium
Stars: ✭ 959 (-0.52%)
Mutual labels:  image-processing
Imagery
Imagery simplifies image manipulations.
Stars: ✭ 27 (-97.2%)
Mutual labels:  image-processing
Tensorflow object counting api
🚀 The TensorFlow Object Counting API is an open source framework built on top of TensorFlow and Keras that makes it easy to develop object counting systems!
Stars: ✭ 956 (-0.83%)
Mutual labels:  image-processing
Handy Image Processor
A handy Image Processor for NodeJS. 📷📷📷
Stars: ✭ 14 (-98.55%)
Mutual labels:  image-processing
Detection Of Breast Cancer Using Neural Networks
This project is made in Matlab Platform and it detects whether a person has cancer or not by taking into account his/her mammogram.
Stars: ✭ 15 (-98.44%)
Mutual labels:  image-processing
Imgsquash
Simple image compression full website code written in node, react and next.js framework. Easy to deploy as a microservice.
Stars: ✭ 948 (-1.66%)
Mutual labels:  image-processing
St Cgan
Dataset and Code for our CVPR'18 paper ST-CGAN: "Stacked Conditional Generative Adversarial Networks for Jointly Learning Shadow Detection and Shadow Removal"
Stars: ✭ 13 (-98.65%)
Mutual labels:  image-processing
Animeavataar
creating Anime Avataar from a facial image
Stars: ✭ 31 (-96.78%)
Mutual labels:  image-processing
Pymatting
A Python library for alpha matting
Stars: ✭ 860 (-10.79%)
Mutual labels:  image-processing
Pytorch Toolbelt
PyTorch extensions for fast R&D prototyping and Kaggle farming
Stars: ✭ 942 (-2.28%)
Mutual labels:  image-processing
Photon
⚡ Rust/WebAssembly image processing library
Stars: ✭ 963 (-0.1%)
Mutual labels:  image-processing
Rivuletpy
Robust 3D Neuron Tracing / General 3D tree structure extraction in Python for 3D images powered by the Rivulet2 algorithm. Pain-free Install & use in 5 mins.
Stars: ✭ 32 (-96.68%)
Mutual labels:  image-processing
Smartcircle
✂️Automatically determine where to crop a circular image out of a rectangular.
Stars: ✭ 29 (-96.99%)
Mutual labels:  image-processing

Rembg

Downloads Downloads Downloads License

Rembg is a tool to remove images background. That is it.

Requirements

How to install torch/torchvision

Go to https://pytorch.org and scrool down to INSTALL PYTORCH section and follow the instructions.

For example:

PyTorch Build: Stable (1.7.1)
Your OS: Windows
Package: Pip
Language: Python
CUDA: None

The install cmd is:

pip install torch==1.7.1+cpu torchvision==0.8.2+cpu -f https://download.pytorch.org/whl/torch_stable.html

Installation

Install it from pypi

pip install rembg

Usage as a cli

Remove the background from a remote image

curl -s http://input.png | rembg > output.png

Remove the background from a local file

rembg -o path/to/output.png path/to/input.png

Remove the background from all images in a folder

rembg -p path/to/inputs

Usage as a server

Start the server

rembg-server

Open your browser to

http://localhost:5000?url=http://image.png

Also you can send the file as a FormData (multipart/form-data):

<form action="http://localhost:5000" method="post" enctype="multipart/form-data">
   <input type="file" name="file"/>
   <input type="submit" value="upload"/>
</form>

Usage as a library

Example 1: Read from stdin and write to stdout

In app.py

import sys
from rembg.bg import remove

sys.stdout.buffer.write(remove(sys.stdin.buffer.read()))

Then run

cat input.png | python app.py > out.png

Example 2: Using PIL

In app.py

from rembg.bg import remove
import numpy as np
import io
from PIL import Image

input_path = 'input.png'
output_path = 'out.png'

f = np.fromfile(input_path)
result = remove(f)
img = Image.open(io.BytesIO(result)).convert("RGBA")
img.save(output_path)

Then run

python app.py

Usage as a docker

Just run

curl -s http://input.png | docker run -i -v ~/.u2net:/root/.u2net danielgatis/rembg:latest > output.png

Advance usage

Sometimes it is possible to achieve better results by turning on alpha matting. Example:

curl -s http://input.png | rembg -a -ae 15 > output.png
Original Without alpha matting With alpha matting (-a -ae 15)

References

License

Copyright (c) 2020-present Daniel Gatis

Licensed under MIT License

Buy me a coffee

Liked some of my work? Buy me a coffee (or more likely a beer)

Buy Me A Coffee

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].