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.1.tar.gz (14.6 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.1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clipx-0.4.1.tar.gz
  • Upload date:
  • Size: 14.6 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.1.tar.gz
Algorithm Hash digest
SHA256 216b240960826431aa6495bfff573de9fae7d3a5e02897a78ce965b23bccf3d2
MD5 637f89a7baf22f23707ee80188ade9cd
BLAKE2b-256 7cf16de65bbf0d48d8493631d59de201d10bd1c353ece47431022ed1f433906b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clipx-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 16.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f60f1ac7f6b440a819e8235497ddce2e99988d43a1956c334674bfeb4eac351e
MD5 971c277596f6fd1ee517b778b7f03772
BLAKE2b-256 d5c17568a28a137c5113d9d4d605d19057766cecdc26af265b9d0cdbffc4fc77

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