Skip to main content

pith-jpeg

pith-jpeg

pith jpeg lane: baseline and progressive JPEG decoding, byte-exact with libjpeg islow (zero-dep Rust)

CI CD Latest release semantic-release License: MIT

Install · Quick start · Suite contract

The pith suite contract

pith-jpeg is part of the pith suite (pith-hash). Every suite repository follows the same rules; CI enforces them mechanically:

  • Naming: a library is always pith-<domain> (pith-image, pith-audio, pith-zip, ...). The curator/repository of repositories is the bare pith-hash. Never invent a second naming scheme inside the suite.
  • Version pinning: cross-library dependencies pin ~0.1 (e.g. pith-image = { version = "~0.1", path = "../pith-image" }). The whole suite moves together inside 0.1.x; breaking changes require a suite-wide version bump, never a silent minor drift.
  • Zero third-party dependencies: every crate depends only on other pith-* crates plus std. scripts/check-zero-deps.py (run in CI) fails the build on any other crate, for normal, build and dev dependencies alike.
  • No unsafe: every crate root carries #![forbid(unsafe_code)].
  • Hex-exact vectors: reference.json at the repo root is the cross-language source of truth. The gen-reference binary regenerates it; CI verifies the committed copy is current (gen-reference verify), and CD ships the regenerated file with every SDK artifact. Python, Node and Go SDKs MUST test against the same bytes.

Repository layout

crates/            one published crate per suite lib (pith-<domain>)
tools/gen-reference  the vector generator binary (bin name: gen-reference)
sdk/python         ctypes wheel; build backend reads PITH_CDYLIB_DIR
sdk/node           koffi-based package; prebuilds/<os-arch>/ carry the cdylib
sdk/go             cgo binding; go.mod carries the module's cgo flags
fuzz/corpus        fuzz inputs, replayed by tests/fuzz_corpus.rs (parser crates)
reference.json     hex-exact cross-SDK test vectors

Overview

JPEG decoding per ITU T.81: baseline (SOF0), extended sequential (SOF1) and progressive (SOF2) Huffman-coded frames — spectral selection, successive approximation and EOBRUN included — with restart markers, 4:4:4/4:2:2/4:4:0/4:2:0 and other integral sampling factors, and 1- or 3-component output as pith_image::raster::Image (Gray/Rgb, 8-bit).

The pixel pipeline is a byte-exact transcription of libjpeg-turbo's islow integer IDCT, fancy triangle chroma upsampling and fixed-point YCbCr→RGB, validated against Pillow 12.3.0 fixtures byte for byte (see tests/fixtures/PROVENANCE.md). Arithmetic-coded, lossless, differential, hierarchical, 12-bit and CMYK/YCCK streams are refused with Error::Unsupported naming the coding process.

Install

Rust (the core library):

cargo add pith-jpeg

Python / Node / Go SDKs are published from the same cdylib on every release; see the release assets or the package registries for the matching version.

Quick start

Rust (the core library):

let img = pith_jpeg::decode(&bytes)?;

match img {
    pith_jpeg::Jpeg::Gray(g) => println!("{}x{}", g.width(), g.height()),
    pith_jpeg::Jpeg::Rgb(rgb) => println!("{}x{}", rgb.width(), rgb.height()),
}

decode never panics on untrusted input: malformed structure surfaces as Error::Truncated / Error::BadValue, refusals as Error::Unsupported. Hex-exact cross-SDK vectors — decode digests for every committed fixture plus the DCT/dequant numerics — live in reference.json (regenerate with cargo run --bin gen-reference, verify with cargo run --bin gen-reference -- verify).

Contributing

See CONTRIBUTING.md.

Security

See SECURITY.md.

License

MIT © pith-hash

Metadata

Release files for pith-jpeg 0.1.1

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

Built distributions (wheels)

Table of built distributions (wheels) for pith-jpeg 0.1.1
File Actions
pith_jpeg-0.1.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for pith_jpeg-0.1.1-py3-none-win_amd64.whl
pith_jpeg-0.1.1-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details for pith_jpeg-0.1.1-py3-none-manylinux_2_34_x86_64.whl
pith_jpeg-0.1.1-py3-none-manylinux_2_34_aarch64.whl Python 3 none Linux glibc 2.34+ ARM64 Details for pith_jpeg-0.1.1-py3-none-manylinux_2_34_aarch64.whl
pith_jpeg-0.1.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for pith_jpeg-0.1.1-py3-none-macosx_11_0_arm64.whl
pith_jpeg-0.1.1-py3-none-macosx_10_13_x86_64.whl Python 3 none macOS 10.13+ x86-64 Details for pith_jpeg-0.1.1-py3-none-macosx_10_13_x86_64.whl

Total release size: 901.9 kB

Release files / pith_jpeg-0.1.1-py3-none-win_amd64.whl

Download URL pith_jpeg-0.1.1-py3-none-win_amd64.whl
Size 96.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
573fa624639378794990e0bf270532a1771fb5b1158878cc6254d736ac0c3599
BLAKE2b-256 checksum
How to use checksums
014abd1d9cd1b5eb591ffb3b872712a656546504a1c07953a15e9b2f9178be98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 14, 2026.

Transparency log

Release files / pith_jpeg-0.1.1-py3-none-manylinux_2_34_x86_64.whl

Download URL pith_jpeg-0.1.1-py3-none-manylinux_2_34_x86_64.whl
Size 214.5 kB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
73cb75e23a22290eefa3769dda3c3cfec000799b4d5d94956db6482b2bd4ea33
BLAKE2b-256 checksum
How to use checksums
633482a33a486c8e4e16ef79f013edc496237802c32beea2cf13c9faca526001
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 14, 2026.

Transparency log

Release files / pith_jpeg-0.1.1-py3-none-manylinux_2_34_aarch64.whl

Download URL pith_jpeg-0.1.1-py3-none-manylinux_2_34_aarch64.whl
Size 209.8 kB
Tags Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
45a3b1ddd608460b73fe554d735f3243728b2351a65c197e094b2b8ec73fd7d4
BLAKE2b-256 checksum
How to use checksums
cb8fe1d4867929bbe4b01b1f710ff524978975b599b7cdb28abdd4cadf2672a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 14, 2026.

Transparency log

Release files / pith_jpeg-0.1.1-py3-none-macosx_11_0_arm64.whl

Download URL pith_jpeg-0.1.1-py3-none-macosx_11_0_arm64.whl
Size 188.3 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4cc953234e01b7ed217bfa054f1078ce6487fcd908dae83a995683217256f486
BLAKE2b-256 checksum
How to use checksums
f191239b0ad5a67ca82838a9809a58f5da82b01c0c12061d5c1ab157a5b819ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 14, 2026.

Transparency log

Release files / pith_jpeg-0.1.1-py3-none-macosx_10_13_x86_64.whl

Download URL pith_jpeg-0.1.1-py3-none-macosx_10_13_x86_64.whl
Size 192.6 kB
Tags Python 3 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
07113928915f9da93386b6e9ce2bd17031aac386bbc9e513267a35dcb321e2bc
BLAKE2b-256 checksum
How to use checksums
c8eeb541cfd3e6256f3fb6bea815fcecef4d5ca625c63f198d9661b7a2186631
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 14, 2026.

Transparency log

Security for pith-jpeg 0.1.1

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.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for pith_jpeg-0.1.1-py3-none-win_amd64.whl

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 Oct 14, 2026.

Transparency log

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.

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