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.4.0.tar.gz (14.4 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.4.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for clipx-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7080b85d9755754269ef67c1f6ee767c3219c6da6a1ed8ca1beb7167459dbcbf
MD5 d8a8da19879634feecc639c76d8e896b
BLAKE2b-256 ef0a87bc35452aa1f9388373ba9c7460427d09093cbfcbb48563893874b363f2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for clipx-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb90adad360d57010d8944e7edd1bde4649b94c069402569b4e75a5319b59ce3
MD5 62553e883e2b600a3030c818575772a2
BLAKE2b-256 7a762756feebbc26e0e0bee80d53ff90091465b2104c69cd6afaef265175a88a

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