All Projects → brilam → Remove Bg

brilam / Remove Bg

Licence: mit
A Python API wrapper for removing background using remove.bg's API

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Remove Bg

Matrix React Sdk
Matrix SDK for React Javascript
Stars: ✭ 590 (-2.64%)
Mutual labels:  hacktoberfest
Cordova Js
Apache Cordova JavaScript Bridge
Stars: ✭ 598 (-1.32%)
Mutual labels:  hacktoberfest
Materialdialog Android
📱Android Library to implement animated, 😍beautiful, 🎨stylish Material Dialog in android apps easily.
Stars: ✭ 602 (-0.66%)
Mutual labels:  hacktoberfest
Saleor Storefront
A GraphQL-powered, PWA, single-page application storefront for Saleor.
Stars: ✭ 591 (-2.48%)
Mutual labels:  hacktoberfest
Memento
Simple + Powerful interface to the Mnesia Distributed Database 💾
Stars: ✭ 597 (-1.49%)
Mutual labels:  hacktoberfest
Core
Simple forum software for building great communities.
Stars: ✭ 5,372 (+786.47%)
Mutual labels:  hacktoberfest
Platform
Ushahidi Platform API version 3+
Stars: ✭ 587 (-3.14%)
Mutual labels:  hacktoberfest
Images To Pdf
An app to convert images to PDF file!
Stars: ✭ 602 (-0.66%)
Mutual labels:  hacktoberfest
Homebrewery
Create authentic looking D&D homebrews using only markdown
Stars: ✭ 598 (-1.32%)
Mutual labels:  hacktoberfest
Bookreader
The Internet Archive BookReader
Stars: ✭ 596 (-1.65%)
Mutual labels:  hacktoberfest
Authpass
AuthPass - Password Manager based on Flutter for all platforms. Keepass 2.x (kdbx 3.x) compatible.
Stars: ✭ 591 (-2.48%)
Mutual labels:  hacktoberfest
Yupe
Yupe! is an open source Yiiframework-based online e-commerce solution. Demo https://demo.yupe.ru/
Stars: ✭ 596 (-1.65%)
Mutual labels:  hacktoberfest
Xamarin.forms
Xamarin.Forms Official Home
Stars: ✭ 5,485 (+805.12%)
Mutual labels:  hacktoberfest
Badgehub
A way to quickly add a notification badge icon to any view. Make any view of a full-fledged animated notification center.
Stars: ✭ 592 (-2.31%)
Mutual labels:  hacktoberfest
Earthdata Search
Earthdata Search is a web application developed by NASA EOSDIS to enable data discovery, search, comparison, visualization, and access across EOSDIS' Earth Science data holdings.
Stars: ✭ 602 (-0.66%)
Mutual labels:  hacktoberfest
Stash
An organizer for your porn, written in Go
Stars: ✭ 591 (-2.48%)
Mutual labels:  hacktoberfest
Graphite Web
A highly scalable real-time graphing system
Stars: ✭ 5,384 (+788.45%)
Mutual labels:  hacktoberfest
Awesome Oneliner Bugbounty
A collection of awesome one-liner scripts especially for bug bounty tips.
Stars: ✭ 594 (-1.98%)
Mutual labels:  hacktoberfest
Challenges
PyBites Code Challenges
Stars: ✭ 604 (-0.33%)
Mutual labels:  hacktoberfest
Runtime
.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
Stars: ✭ 7,742 (+1177.56%)
Mutual labels:  hacktoberfest

remove-bg

A Python API wrapper for removing backgrounds from picture using remove.bg's API.

License

This code is licensed under the MIT License. See here for more details.

Installation

pip install removebg

Usage

remove_background_from_img_file

Removes the background given an image file.

Parameter Default Value Description
img_file_path req. param path to the source image file
size 'regular' size of the output image ('auto' = highest available resolution, 'preview'
type 'auto' foreground object ('auto' = autodetect, 'person', 'product', 'car')
type_level 'none' classification level of the foreground object ('none' = no classification, '1' = coarse classification (e.g. 'car'), '2' = specific classification (e.g. 'car_interior'), 'latest' = latest classification)
format 'auto' image format ('auto' = autodetect, 'png', 'jpg', 'zip')
roi '0 0 100% 100%' region of interest, where to look for foreground object (x1, y1, x2, y2) in px or relative (%)
crop None px or relative, single val = all sides, two vals = top/bottom, left/right, four vals = top, right, bottom, left
scale 'original' image scale relative to the total image size
position 'original' 'center', 'original', single val = horizontal and vertical, two vals = horizontal, vertical
channels 'rgba' request the finalized image ('rgba') or an alpha mask ('alpha')
shadow False whether to add an artificial shadow (some types aren't supported)
semitransparency True semitransparency for windows or glass objects (some types aren't supported)
bg None background (None = no background, path, url, color hex code (e.g. '81d4fa', 'fff'), color name (e.g. 'green'))
bg_type None background type (None = no background, 'path', 'url', 'color')
new_file_name 'no-bg.png' file name of the result image

Code Example:

from removebg import RemoveBg

rmbg = RemoveBg("YOUR-API-KEY", "error.log")
rmbg.remove_background_from_img_file("joker.jpg")

remove_background_from_img_url

Removes the background given an image URL.

Parameter Default Value Description
img_url req. param URL to the source image
size 'regular' size of the output image ('auto' = highest available resolution, 'preview'
type 'auto' foreground object ('auto' = autodetect, 'person', 'product', 'car')
type_level 'none' classification level of the foreground object ('none' = no classification, '1' = coarse classification (e.g. 'car'), '2' = specific classification (e.g. 'car_interior'), 'latest' = latest classification)
format 'auto' image format ('auto' = autodetect, 'png', 'jpg', 'zip')
roi '0 0 100% 100%' region of interest, where to look for foreground object (x1, y1, x2, y2) in px or relative (%)
crop None px or relative, single val = all sides, two vals = top/bottom, left/right, four vals = top, right, bottom, left
scale 'original' image scale relative to the total image size
position 'original' 'center', 'original', single val = horizontal and vertical, two vals = horizontal, vertical
channels 'rgba' request the finalized image ('rgba') or an alpha mask ('alpha')
shadow False whether to add an artificial shadow (some types aren't supported)
semitransparency True semitransparency for windows or glass objects (some types aren't supported)
bg None background (None = no background, path, url, color hex code (e.g. '81d4fa', 'fff'), color name (e.g. 'green'))
bg_type None background type (None = no background, 'path', 'url', 'color')
new_file_name 'no-bg.png' file name of the result image

Code Example:

from removebg import RemoveBg

rmbg = RemoveBg("YOUR-API-KEY", "error.log")
rmbg.remove_background_from_img_url("http://www.example.com/some_image.jpg")

remove_background_from_base64_img

Removes the background given a base64 image string.

Parameter Default Value Description
base64_img req. param base64 image string
size 'regular' size of the output image ('auto' = highest available resolution, 'preview'
type 'auto' foreground object ('auto' = autodetect, 'person', 'product', 'car')
type_level 'none' classification level of the foreground object ('none' = no classification, '1' = coarse classification (e.g. 'car'), '2' = specific classification (e.g. 'car_interior'), 'latest' = latest classification)
format 'auto' image format ('auto' = autodetect, 'png', 'jpg', 'zip')
roi '0 0 100% 100%' region of interest, where to look for foreground object (x1, y1, x2, y2) in px or relative (%)
crop None px or relative, single val = all sides, two vals = top/bottom, left/right, four vals = top, right, bottom, left
scale 'original' image scale relative to the total image size
position 'original' 'center', 'original', single val = horizontal and vertical, two vals = horizontal, vertical
channels 'rgba' request the finalized image ('rgba') or an alpha mask ('alpha')
shadow False whether to add an artificial shadow (some types aren't supported)
semitransparency True semitransparency for windows or glass objects (some types aren't supported)
bg None background (None = no background, path, url, color hex code (e.g. '81d4fa', 'fff'), color name (e.g. 'green'))
bg_type None background type (None = no background, 'path', 'url', 'color')
new_file_name 'no-bg.png' file name of the result image

Code Example:

from removebg import RemoveBg
import base64

rmbg = RemoveBg("YOUR-API-KEY", "error.log")
with open("joker.jpg", "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read())
rmbg.remove_background_from_base64_img(encoded_string)

Contributions

Contributions and feature requests are always welcome.

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].