# Rust JPEG XR Codec

Canonical page: https://frames-sg.com/rust-jpeg-xr-codec/

`jxr` inspects and decodes JPEG XR codestreams and Annex-A still-image files in Rust. The default build uses the portable CPU implementation and requires no GPU runtime or reference codec. Optional NVIDIA CUDA and Apple Metal crates reconstruct supported inputs on the GPU.

## Capabilities

- Inspect dimensions, color format, sample representation, tiling, orientation, alpha and container metadata without decoding pixels.
- Decode full images or regions, limiting reconstruction to the needed tiles and overlap halo.
- Decode frequency-mode images at one-quarter or one-sixteenth width and height without reconstructing unneeded higher-frequency bands on the CPU.
- Preserve grayscale, RGB/BGR, CMYK, multichannel, planar YUV, integer, floating-point, packed RGB/RGBE and alpha representations where supported.
- Prepare batches once, group compatible output shapes and reuse CPU workers or GPU sessions.
- Transfer supported output into the `image` crate or Apple MPSGraph.
- Wrap an existing codestream in an Annex-A still-image file with validated metadata.

## Scope

The supported syntax boundary is Main-profile JPEG XR. Pixel-to-codestream encoding, Advanced-only output syntax, Annex-F/HEIF sequences and transcoding are outside the current scope.

## Install and references

```sh
cargo add jxr
```

- [API documentation](https://docs.rs/jxr)
- [Source repository](https://github.com/frames-sg/jxr)
- [Support guide](https://github.com/frames-sg/jxr/blob/main/docs/support.md)
- [Whole-slide imaging in Rust](https://frames-sg.com/whole-slide-imaging-rust/)
