Decode and encode
The j2k facade owns public HTJ2K application APIs for raw HT codestreams and JPH still-image files, including cleanup and refinement packet paths.
cargo add j2k
HTJ2K Rust
J2K supports HTJ2K Part 15 Rust APIs for HT codestream decode, encode, recode, JPH still-image wrapping, and JPEG-to-HTJ2K transcode workflows, with optional CUDA and Metal backends for supported routes.
Release status: See GitHub Releases and crates.io for the current version.
The j2k facade owns public HTJ2K application APIs for raw HT codestreams and JPH still-image files, including cleanup and refinement packet paths.
cargo add j2k
Reversible 5/3 gray and RGB inputs with unsigned 8- or 16-bit samples are recoded in the coefficient domain. Other inputs (signed, other bit depths, lossy, or palette-mapped) are decoded and re-encoded losslessly, with identical pixels.
j2k-transcode provides JPEG-to-HTJ2K coefficient-domain transcode primitives, with CUDA and Metal acceleration crates for supported transform stages.
cargo add j2k-transcode
HT cleanup, significance-propagation refinement, magnitude-refinement, packet length signaling, quality-layer contributions, and strict decoding are covered by tests in the repository.
JPH wrapping and inspection reuse the JP2 box parser and validate HT codestream branding so HTJ2K files are distinct from classic JP2 files.
HTJ2K requests above the Part 15 coded-bitplane limit return an error. OpenJPH and Kakadu are used only for benchmark comparisons, never as a runtime fallback.
See Rust JPEG 2000 Codec, CUDA JPEG2000 Rust, Metal JPEG2000 Rust, and GPU Backends for related codec and backend pages.