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.2.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.4.2-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clipx-0.4.2.tar.gz
  • Upload date:
  • Size: 15.0 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.2.tar.gz
Algorithm Hash digest
SHA256 ed8252fdde6e389763042634494049e2b6f1be4d870719aa33648914b9108388
MD5 40695b5f4543c2bd829a90e5e957aff9
BLAKE2b-256 90fe7df2a36d9adb71841e4c05d74a35d95a789a7c6155826fe71fc75b9bfe46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clipx-0.4.2-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.11.9

File hashes

Hashes for clipx-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d93dc7b7637440d271549b76a76158d446e35e8635027dd6a83b352ae31bef8
MD5 d1e401e95ca98f8d8f584a48856c1251
BLAKE2b-256 77a33911abff08d20ac943b723884d3d69891cd21503f097ecc862202f680b4f

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