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"})
Metadata
Release files for pymtpng 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pymtpng-1.1.0.tar.gz | 24.5 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pymtpng-1.1.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| pymtpng-1.1.0-cp312-abi3-manylinux_2_34_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.34+ x86-64 | Details |
Total release size: 881.7 kB
Release files / pymtpng-1.1.0.tar.gz
| Download URL | pymtpng-1.1.0.tar.gz |
|---|---|
| Size | 24.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e019222e2eedd97bb7f4ce8d3377ca4769a72815932a4861e541bed3d9ddb239
|
|
BLAKE2b-256 checksum How to use checksums |
2afeee866f4a0886f84ea1129fdc816ca3720e4bf31fba693fe38d28d7087217
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.
Transparency logRelease files / pymtpng-1.1.0-cp312-abi3-win_amd64.whl
| Download URL | pymtpng-1.1.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 220.9 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
43fd96e68d130f1a0af94ee5fe186472696386c57ebf230c0473b2f9118159dd
|
|
BLAKE2b-256 checksum How to use checksums |
8bb0467884bcfbd559237699df095e1e0acc66a46ab1be5e3fa44463e72a65e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.
Transparency logRelease files / pymtpng-1.1.0-cp312-abi3-manylinux_2_34_x86_64.whl
| Download URL | pymtpng-1.1.0-cp312-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 636.2 kB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
73b47747483a44b3091ba8fdf3ddcbeab9cf3931f0be1d28131cb2b0210c2c92
|
|
BLAKE2b-256 checksum How to use checksums |
99ae1b8155695bd14c8b89ed260130842d0a5594efa4083109d5096e4caa64ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.
Transparency log