Skip to main content

Python bindings for MTPNG library

Project description

Python pymtpng

Python bindings for the MTPNG library, a parallelized PNG encoder in Rust by Brion Vibber.

Build prerequisites

  • Python 3.12+
  • Rust toolchain (cargo)
  • CMake >=3.24
  • Ninja
  • C++20 compiler

Build with dependencies from lockfile

uv sync --no-install-project
uv build --wheel --no-build-isolation

Develop with auto rebuild

uv sync
uv run ruff check .
uv run pytest

Usage

import pymtpng

# Encode numpy uint8 array to PNG
with open("image_uint8.png", "wb") as fh:
    pymtpng.encode_png(image_uint8, fh)

# Encode numpy uint16 array to PNG
with open("image_uint16.png", "wb") as fh:
    pymtpng.encode_u16_png(image_uint16, fh)

# Customize encoding options
pymtpng.encode_png(
    image,
    fh,
    filter=pymtpng.Filter.Adaptive,
    compression_level=pymtpng.CompressionLevel.Fast,
    strategy=pymtpng.Strategy.Huffman,
)

# Store key-value pairs as iTXt chunks
pymtpng.encode_png(image, fh, info={"Hello": "World"})

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

pymtpng-1.1.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distributions

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

pymtpng-1.1.0-cp312-abi3-win_amd64.whl (220.9 kB view details)

Uploaded CPython 3.12+Windows x86-64

pymtpng-1.1.0-cp312-abi3-manylinux_2_34_x86_64.whl (636.2 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.34+ x86-64

File details

Details for the file pymtpng-1.1.0.tar.gz.

File metadata

  • Download URL: pymtpng-1.1.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pymtpng-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e019222e2eedd97bb7f4ce8d3377ca4769a72815932a4861e541bed3d9ddb239
MD5 19f5f70cfef3456f8cdd32d64d6aa5b2
BLAKE2b-256 2afeee866f4a0886f84ea1129fdc816ca3720e4bf31fba693fe38d28d7087217

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymtpng-1.1.0.tar.gz:

Publisher: pypi-packages.yml on pwuertz/pymtpng

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

File details

Details for the file pymtpng-1.1.0-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: pymtpng-1.1.0-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 220.9 kB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pymtpng-1.1.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 43fd96e68d130f1a0af94ee5fe186472696386c57ebf230c0473b2f9118159dd
MD5 be28b3c5faf11cf62a746dcceaf49969
BLAKE2b-256 8bb0467884bcfbd559237699df095e1e0acc66a46ab1be5e3fa44463e72a65e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymtpng-1.1.0-cp312-abi3-win_amd64.whl:

Publisher: pypi-packages.yml on pwuertz/pymtpng

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

File details

Details for the file pymtpng-1.1.0-cp312-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pymtpng-1.1.0-cp312-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 73b47747483a44b3091ba8fdf3ddcbeab9cf3931f0be1d28131cb2b0210c2c92
MD5 858d91320eff83abe0b858e398e29e2b
BLAKE2b-256 99ae1b8155695bd14c8b89ed260130842d0a5594efa4083109d5096e4caa64ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymtpng-1.1.0-cp312-abi3-manylinux_2_34_x86_64.whl:

Publisher: pypi-packages.yml on pwuertz/pymtpng

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