Metadata-Version: 2.5
Name: entirius-py-image-transformations
Version: 2.0.1
Summary: Image resize and background removal (Pillow + OpenCV), part of Entirius, the open-source modular ecommerce platform
Project-URL: Homepage, https://docs.entirius.com/
Project-URL: Documentation, https://docs.entirius.com/
Project-URL: Repository, https://github.com/entirius/entirius-py-image-transformations
Project-URL: Changelog, https://github.com/entirius/entirius-py-image-transformations/blob/develop/CHANGELOG.md
Project-URL: Issues, https://github.com/entirius/entirius-py-image-transformations/issues
Author: Entirius
License-Expression: MPL-2.0
License-File: LICENSE
Keywords: background-removal,entirius,image,opencv,pillow,resize
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: matplotlib>=3.5
Requires-Dist: opencv-contrib-python>=4.5
Requires-Dist: pillow>=13.0.0
Provides-Extra: dev
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown

# entirius-py-image-transformations

Image resize and background-removal functions built on Pillow and OpenCV, part of
Entirius, the open-source modular ecommerce platform. Each function reads a source file and writes the transformed
image to a target path.

[![PyPI](https://img.shields.io/pypi/v/entirius-py-image-transformations.svg)](https://pypi.org/project/entirius-py-image-transformations/)
[![Python](https://img.shields.io/pypi/pyversions/entirius-py-image-transformations.svg)](https://pypi.org/project/entirius-py-image-transformations/)
[![License: MPL-2.0](https://img.shields.io/badge/license-MPL--2.0-blue.svg)](https://github.com/entirius/entirius-py-image-transformations/blob/develop/LICENSE)

## What it does

- Ratio-safe resizes with a white, black, pink or transparent background (`resize_ratio_safe_bg_*`).
- Fill-and-crop resizes with the same four backgrounds (`resize_fill_crop_bg_*`).
- Background removal with a kernel (`remove_background_with_kernel()`).
- Background removal by flood fill (`remove_background_flood_fill()`).

## Installation

```shell
uv add entirius-py-image-transformations
pip install entirius-py-image-transformations
```

The import name is `image_transformations`.

## Quick start

```python
from image_transformations import resize_ratio_safe_bg_white, remove_background_flood_fill

resize_ratio_safe_bg_white("in.jpg", "out.jpg", 500, 500)
remove_background_flood_fill("in.jpg", "out.png")
```

## Requirements

- Python 3.11 or newer.
- `pillow`, `opencv-contrib-python` and `matplotlib` (installed as dependencies).

## Documentation

- Entirius documentation: https://docs.entirius.com/
- Changelog: https://github.com/entirius/entirius-py-image-transformations/blob/develop/CHANGELOG.md

## Part of Entirius

This library transforms the product and content images of the Entirius backend service (Volkanos) and its modules.

- Backend service: https://github.com/entirius/entirius-service-volkanos
- Docker harness: https://github.com/entirius/entirius-zeno
- Consumer modules: https://github.com/entirius/entirius-django-pim, https://github.com/entirius/entirius-django-contentdb

## Development

```shell
make install     # sync dependencies (uv)
make check       # lint + format check (ruff)
make test        # test suite (pytest); smoke transformations over tests/examples/
```

Development and agent instructions: https://github.com/entirius/entirius-py-image-transformations/blob/develop/AGENTS.md

## License

Mozilla Public License 2.0 (MPL-2.0) — see https://github.com/entirius/entirius-py-image-transformations/blob/develop/LICENSE.
