Make images with transparent background
Project description
Transparent Background
This is a background removing tool based on InSPyReNet (ACCV 2022).
Install
# via pypi
pip install transparent-background
# locally
pip install . e
Usage
Command Line
transparent-background --source [SOURCE] --dest [DEST] --type [TYPE]
--source [SOURCE]
: Specify your data in this argument.- Single image -
image.png
- Folder containing images -
path/to/img/folder
- Single video -
video.mp4
- Folder containing videos -
path/to/vid/folder
- Single image -
--dest [DEST]
(optional): Specify your destination folder. If not specified, it will be saved in current directory.--type [TYPE]
: Choose betweenmap
green
,rgba
,blur
,overlay
, and another image file.rgba
will generate RGBA output regarding saliency score as an alpha map. Note that this will not work for video input.map
will output saliency map only.green
will change the background with green screen.blur
will blur the background.overlay
will cover the salient object with translucent green color, and highlight the edges.- Another image file (e.g.,
backgroud.png
) will be used as a background, and the object will be overlapped on it.
Python API
- Usage Example
from PIL import Image
from transparent_background import Remover
remover = Remover()
img = Image.open('figures/sample.jpg')
# default setting - transparent background
out = remover.process(img)
Image.fromarray(out).save('output.png')
# object map only
out = remover.process(img, type='map')
Image.fromarray(out).save('output.png')
# image matting - green screen
out = remover.process(img, type='green')
Image.fromarray(out).save('output.png')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
transparent-background-0.1.tar.gz
(17.5 kB
view hashes)
Built Distribution
Close
Hashes for transparent-background-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9409fd54915e952ae40672dca8d8069e31581f198e08a11c1e1ebd0898643f02 |
|
MD5 | 6375c5522a108b5dfde47bb0729e1a9d |
|
BLAKE2b-256 | 6105b6a2b009f29f0cb6216ef6433343e86d0b7cfb8df38ed24228977814f7cd |
Close
Hashes for transparent_background-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 486f4380e5369d385d603e22d1979591f80500ae45bad331b78ee8cb5be73f6e |
|
MD5 | fdcc3ab0364d602aae55a62537f215b6 |
|
BLAKE2b-256 | 73d2bf886dbc0f9ff7977d264ec9c7b6cbf53907af856df69b53c6289b995e95 |