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
  • Use U2Net only for mask generation:
clipx -i input.jpg -o output.png -m u2net
  • Enable debug logging:
clipx -i input.jpg --debug

Python API Example

# Import the background removal function
from clipx import remove_background

# Remove the background from an image with a single line of code
result = remove_background("photo.jpg")

print(f"Image with background removed saved to: {result}")

Advanced Usage

Logging Configuration

You can configure the logging level:

from clipx import set_log_level, enable_console_logging
import logging

# Enable console logging
enable_console_logging()

# Set log level
set_log_level(logging.DEBUG)

Acknowledgements and Code Sources

The image segmentation models in clipx are based on the following 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.3.0.tar.gz (24.3 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.3.0-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for clipx-0.3.0.tar.gz
Algorithm Hash digest
SHA256 81e16b539421b5cee5f426d18e81fe1d7c4f80259e9d88120ad223ab1bffd020
MD5 e91ec0fc4a440966e6319bd2ef15de7e
BLAKE2b-256 33f819d767fa9f87a7d45f6a9e7e7ab508137a4ee446e858ef66de0632c4eec8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clipx-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 28.8 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56153739632d3ddcfe5ad53e5933a1fe26eea4c846436c23f19560721a2a622e
MD5 3bd43a6c3a202be9751ee0ef4a993b22
BLAKE2b-256 ba4cdaf5bb081d125e150961b8615e64eba54e253bc3b20455b28436650ef763

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