Skip to main content

Make images with transparent background

Project description

Transparent Background

This is a background removing tool powered by InSPyReNet (ACCV 2022). You can easily remove background from the image or video or bunch of other stuffs when you can make the background transparent!

:inbox_tray: Install

# via pypi
pip install transparent-background

# via github
pip install git+https://github.com/plemeri/transparent-background.git

# locally
pip install . e

:pencil2: Usage

:computer: 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
  • --dest [DEST] (optional): Specify your destination folder. If not specified, it will be saved in current directory.
  • --type [TYPE]: Choose between rgba, map green, 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.

:crystal_ball: Python API

  • Usage Example
from PIL import Image
from transparent_background import Remover

remover = Remover()
img = Image.open('samples/aeroplane.jpg')

# default setting - transparent background
out = remover.process(img)
Image.fromarray(out).save('samples/aeroplane_rgba.png')

# object map only
out = remover.process(img, type='map')
Image.fromarray(out).save('samples/aeroplane_map.png')

# image matting - green screen
out = remover.process(img, type='green')
Image.fromarray(out).save('samples/aeroplane_green.png')

# blur background
out = remover.process(img, type='blur')
Image.fromarray(out).save('samples/aeroplane_blur.png')

# overlay object map onto the image
out = remover.process(img, type='overlay')
Image.fromarray(out).save('samples/aeroplane_overlay.png')

# use another image as a background
out = remover.process(img, type='samples/sheep.jpg')
Image.fromarray(out).save('samples/aeroplane_png.png')

:outbox_tray: Uninstall

pip uninstall transparent-background

:page_facing_up: Licence

See LICENCE for more details.

Project details


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-1.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transparent_background-1.0-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file transparent-background-1.0.tar.gz.

File metadata

  • Download URL: transparent-background-1.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.15

File hashes

Hashes for transparent-background-1.0.tar.gz
Algorithm Hash digest
SHA256 f2e20e2b2c7392be9ca8de53615c4454599a1880429909a3e3f4d7803629154f
MD5 1ed336399a0aba47fc235d3b19c8d27d
BLAKE2b-256 d826ef034b5a4614430ca1be6b8ddc15a116ca5dcc72d8fb1961456745a6f34a

See more details on using hashes here.

File details

Details for the file transparent_background-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for transparent_background-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30aa12e6dc882943faffab19fd9e2abee9367e2362c2371c726985930e0f4d7f
MD5 fc7495a2f6e0f71bbcd15d1c48aa94eb
BLAKE2b-256 3152c3b85dcab1fa9980dc9fffe7e231a678fbb734f5d0e65e798d3db82f0202

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page