Skip to main content

Image background removal tool supporting U2Net and CascadePSP models

Project description

clipx

English | 简体中文

Introduction

clipx is an open-source Python library designed for quick and flexible image background removal. It supports both command-line interface (CLI) and Python API usage. Currently, it integrates two image segmentation models, U2Net and CascadePSP, which can be used individually or combined for enhanced performance. Additionally, clipx has an extensible architecture, making it easy to incorporate additional models in the future.


Installation

pip install clipx

CLI Examples

  • Generate transparent image using combined mode (U2Net + CascadePSP):
clipx -i input.jpg
  • Specify output path:
clipx -i input.jpg -o output.png
  • Use fast mode for CascadePSP (faster but less accurate):
clipx -i input.jpg -o output.png --fast

Python API Example

from PIL import Image
from clipx import remove

# Testing the API
img = Image.open("tests/leaves-8273504_1920.jpg")
result = remove(img)
result.save("api_test_result.png")

# Get only the mask
mask = remove(img, only_mask=True)
mask.save("mask_only.png")

Acknowledgements and Code Sources

This project uses code from the following open source projects:

We greatly appreciate the original authors' work and contributions.


License

This project is licensed under the MIT License.

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

clipx-0.5.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

clipx-0.5.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file clipx-0.5.0.tar.gz.

File metadata

  • Download URL: clipx-0.5.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for clipx-0.5.0.tar.gz
Algorithm Hash digest
SHA256 317aa094b6e92145616f159a746271354b36534ce79ec74d8d49e6a9acae76a6
MD5 ff3986883eb3d3d1b07f1230afff888e
BLAKE2b-256 1591247c180226744d67d6d9d80fbd66ce39ec384900eb14959921589ef59c3e

See more details on using hashes here.

File details

Details for the file clipx-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: clipx-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for clipx-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85e4975bf3bf4c1c0d6fa37406f3eace96f8daf14160e24cc87755cd821cae58
MD5 26c83fee5167a15942efc44a7ba2d7db
BLAKE2b-256 23fbda6da149afa0c5ebe3e72567d45eb71843369077b7dec19a7fc4ca79401a

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