Skip to main content

Python bindings for MTPNG library

Project description

Python mtpng

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

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_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.0.4.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distributions

pymtpng-1.0.4-cp312-abi3-win_amd64.whl (219.1 kB view hashes)

Uploaded CPython 3.12+ Windows x86-64

pymtpng-1.0.4-cp311-cp311-win_amd64.whl (220.4 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

pymtpng-1.0.4-cp310-cp310-win_amd64.whl (220.5 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

pymtpng-1.0.4-cp39-cp39-win_amd64.whl (220.7 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page