Metadata-Version: 2.4
Name: pixel-convert
Version: 0.1.0
Classifier: Programming Language :: Python
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Requires-Dist: pillow>=9
Summary: PyO3-powered image transform for Pixel-convert (Rust core)
Keywords: image,rust,pyo3,pillow,clustering
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

pixel_convert (Python package)

This package exposes a Python API backed by the Rust `pixel_convert_rust` core via PyO3.

API
- `pixel_convert.transform(image: PIL.Image.Image, width: int, height: int, kmax: int, *, fast=False, stride=None, stride_x=None, stride_y=None, alpha=None, epsilon_palette=None, t_final=None, stag_eps=None, stag_limit=None, threads=None, iter_timings=False) -> PIL.Image.Image`
- `pixel_convert.transform_file(input_path: str, output_path: str, width: int, height: int, kmax: int, *, fast=False, stride=None, stride_x=None, stride_y=None, alpha=None, epsilon_palette=None, t_final=None, stag_eps=None, stag_limit=None, threads=None, iter_timings=False) -> None`

Build from source
- `pip install maturin`
- `maturin build -m pixel_convert/Cargo.toml --release`
- `pip install target/wheels/*.whl`

Develop install for local testing
- `maturin develop -m pixel_convert/Cargo.toml`

Example
```
from PIL import Image
import pixel_convert as rx

img = Image.open("examples/input_images/dog3.jpg")
out = rx.transform(img, 128, 128, 30, fast=True)
out.save("examples/output_images/dog3_py_128x128_30.png")
```

File-to-file example (faster, Rust handles I/O)
```
import pixel_convert as rx

rx.transform_file(
    "examples/input_images/dog3.jpg",
    "examples/output_images/dog3_py_128x128_30.png",
    128,
    128,
    30,
    fast=True,
    threads=4,
)
```

Timing per iteration (logs)
```
import pixel_convert as rx, os
os.environ["RUST_LOG"] = "info"
rx.transform_file("examples/input_images/dog3.jpg", "examples/output_images/dog3_py_128x128_30.png", 128, 128, 30, iter_timings=True)
```

