Skip to main content

PyO3-powered image transform for Pixel-convert (Rust core)

Project description

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)

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

pixel_convert-0.1.0.tar.gz (23.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pixel_convert-0.1.0-cp39-abi3-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.9+Windows x86-64

pixel_convert-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

pixel_convert-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file pixel_convert-0.1.0.tar.gz.

File metadata

  • Download URL: pixel_convert-0.1.0.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pixel_convert-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2753888a3205ef1fb75375f5b35c483c9534fa63e4f9ae66ba5ca9de8dc45cec
MD5 ddfd7711bf5e318a99290af1c99c509a
BLAKE2b-256 1653ae13fadfbb2b45f7eb0e8f7b85cb4a7aff4542090a91061ad6a5f62700f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_convert-0.1.0.tar.gz:

Publisher: wheels.yml on QAM/pixel-convert

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_convert-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pixel_convert-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1b62eac645c3fa0a75b29b403adeb4e5eda6a34af623177c1ceedfbb3262d606
MD5 fd003c64614f329caaf9e448130818ab
BLAKE2b-256 ab50c390619aceb28efdb3bed28e645814e080db4e3eeba9fc7328e51937cde2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_convert-0.1.0-cp39-abi3-win_amd64.whl:

Publisher: wheels.yml on QAM/pixel-convert

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_convert-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pixel_convert-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 687229c8f5050e32a3f214d0093033a0bcc078a5eb351d0fce29390b8064f48f
MD5 de2d92656693be4272d818fb93a049d9
BLAKE2b-256 a8cdafdc50ee3e8deae281e24eecffc0d935f0590b3b8fb24200e420ebfe1414

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_convert-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on QAM/pixel-convert

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_convert-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pixel_convert-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c68776b6444603e04e38665b03c26dae23ec1ba20359ef721ea137a9d747915
MD5 1458127aa541d45a76b9a74a64e26999
BLAKE2b-256 9d5b766ad6c4d3d63562fcaef5a0d77b239978359dc9800c7dbcbd41efaaa355

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_convert-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: wheels.yml on QAM/pixel-convert

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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