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.0

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.0
File Actions
pith_jpeg-0.1.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for pith_jpeg-0.1.0-cp313-cp313-win_amd64.whl
pith_jpeg-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details for pith_jpeg-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl
pith_jpeg-0.1.0-cp313-cp313-macosx_11_0_universal2.whl CPython 3.13 CPython 3.13 macOS 11.0+ universal2 (ARM64, x86-64) Details for pith_jpeg-0.1.0-cp313-cp313-macosx_11_0_universal2.whl
pith_jpeg-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details for pith_jpeg-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl

Total release size: 714.0 kB

Release files / pith_jpeg-0.1.0-cp313-cp313-win_amd64.whl

Download URL pith_jpeg-0.1.0-cp313-cp313-win_amd64.whl
Size 96.7 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
0f9c907e6a2db0299765950d1ea8fa9b6b447c7569ecb920c014e5ed584b3aae
BLAKE2b-256 checksum
How to use checksums
3f694e7e3623db614fb55620ad23992fd877b703724c3483654b4eded648882c
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.0-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL pith_jpeg-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl
Size 214.5 kB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
4d5bec9f6383dc4df65a98ba3676dcd18b57b71118e5a3f6a62cfb71f0b55b5e
BLAKE2b-256 checksum
How to use checksums
d2b272ecfd553a8e25dc2926907b2beeb5d32f0dd220424937ad07361e8fbbbb
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.0-cp313-cp313-macosx_11_0_universal2.whl

Download URL pith_jpeg-0.1.0-cp313-cp313-macosx_11_0_universal2.whl
Size 188.3 kB
Tags CPython 3.13 macOS 11.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
49956abc82f47941597658427a74e99733dc45f16d72b7566f9a5b9615520178
BLAKE2b-256 checksum
How to use checksums
7279bc26702792def79f89ec273812b1f93afbf59e9b590ba49372abf7f8379f
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.0-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL pith_jpeg-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
Size 214.5 kB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
cc50ff927f770e7e4d49f6ba8df5ae32029c3860190ab0f3d085088953bece02
BLAKE2b-256 checksum
How to use checksums
b65a29d57cc4920fe0d8e373c334a3d99a0cc8e327b8eac417742e1d1d5f1a0c
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 10, 2026.

Transparency log

Security for pith-jpeg 0.1.0

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 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for pith_jpeg-0.1.0-cp313-cp313-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