Skip to main content

png-alpha-benchmark-toolkit

Lossless ISO/IEC 15948 PNG Alpha-Channel Analysis, Scanline Filter Optimization (Sub, Up, Average, Paeth), and Zero-Alpha RGB Entropy Elimination Benchmark Suite maintained by TopPNG.

Overview

When encoding 32-bit RGBA raster graphics with transparent cutouts, standard unoptimized encoders retain arbitrary non-zero (R, G, B) chrominance bytes inside fully transparent pixels (Alpha = 0). Those hidden chrominance transitions degrade spatial predictor accuracy across scanlines (Sub, Up, Average, Paeth) and inflate LZ77/DEFLATE stream entropy.

png-alpha-benchmark-toolkit provides a deterministic reference implementation for:

  1. Zero-Alpha RGB Bleed Elimination: Zeroing (R, G, B) channels wherever A == 0 while strictly preserving partial anti-aliased edge pixels (1 <= A <= 254).
  2. ISO/IEC 15948 Section 9.2 Paeth Predictor Evaluation: Computing exact per-scanline predictor residuals and selecting minimum-entropy filter modes.
  3. Alpha-Channel Trim Bounding-Box Calculation: Locating minimal non-zero alpha bounding boxes (min_x, min_y, max_x, max_y) in O(W * H) time.

Installation

pip install png-alpha-benchmark-toolkit

Quick Start

from png_alpha_benchmark_toolkit import (
    paeth_predictor,
    zero_alpha_rgb_bleed,
    alpha_bounding_box,
)

# 1. Compute ISO/IEC 15948 Section 9.2 Paeth predictor
pred = paeth_predictor(120, 118, 115)

# 2. Zero RGB channels on fully transparent pixels (A == 0)
rgba = bytearray([255, 128, 64, 0, 40, 80, 120, 255])
saved_bytes = zero_alpha_rgb_bleed(rgba)

# 3. Compute tight non-zero alpha bounding box
bbox = alpha_bounding_box(bytes(rgba), width=2, height=1)

License

MIT License — Copyright (c) 2026 TopPNG.

Metadata

Release files for png-alpha-benchmark-toolkit 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for png-alpha-benchmark-toolkit 1.0.2
File Interpreter ABI Platform Actions
png_alpha_benchmark_toolkit-1.0.2-py3-none-any.whl Python 3 none any Details for png_alpha_benchmark_toolkit-1.0.2-py3-none-any.whl

Release files / png_alpha_benchmark_toolkit-1.0.2-py3-none-any.whl

Download URL png_alpha_benchmark_toolkit-1.0.2-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b276e0be7bdae3ce63146f31a766fd858954de6439dc16d02e401886a13e33f
BLAKE2b-256 checksum
How to use checksums
344fe9e50cc75a457a307d0b444ea0d7230d7cc201a75e4777897871cd89dfd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0

Security for png-alpha-benchmark-toolkit 1.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page