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

Uploaded Python 3

File details

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

File metadata

  • Download URL: clipx-0.4.3.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.3.tar.gz
Algorithm Hash digest
SHA256 ccffe3b3e77fdac4a94f723da280e81d6b332fc16200f196b2d06bd4ad3db17f
MD5 9c7ec6e4798ae5b9ab3c6de542187436
BLAKE2b-256 5c7ffb1a468693ee46d291f9a746dc9232521e90fa077e6ec57b5eaf43c39ef5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clipx-0.4.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8190a5234db3a01f1863c6c6604a455a9f373c70aec50c0d8b9e3356ee6738ef
MD5 27f6e891f704baeb6e6dab785c2f3507
BLAKE2b-256 d7a8fbfd3d0a5037e7ccc43024e0bc0a960270d3f3b344ce7d0a88e593c672c7

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