# Frames: GPU-accelerated JPEG 2000 and HTJ2K

Canonical page: https://frames-sg.com/

Frames, also known as Frames-sg, provides open-source codecs in Rust, with Apple Metal and NVIDIA CUDA acceleration for supported JPEG 2000 and HTJ2K operations. The libraries inspect, decode, encode and transcode images, with region and reduced-resolution access. CPU implementations are also available. Supporting libraries provide JPEG inspection, decoding and encoding, including TIFF JPEG tile preparation for slide formats. JPEG XR decoding is available separately.

## Applications

- **Digital pathology:** [`wsi-rs`](https://frames-sg.com/whole-slide-imaging-rust/) reads supported whole-slide scanner files and extracts image regions. It also reads supported Zeiss CZI brightfield scans compressed with [JPEG XR](https://frames-sg.com/rust-jpeg-xr-codec/). `wsi-dicom` exports supported whole-slide images as DICOM VL Whole Slide Microscopy images. `wsi-dicom-annotations` converts supported annotations into DICOM.
- **Image archives:** Applications can encode lossless JP2 or JPH images, decode reduced-resolution views, and transcode supported baseline JPEG inputs to HTJ2K from DCT coefficients.
- **Medical imaging:** [DICOM whole-slide conversion](https://frames-sg.com/dicom-whole-slide-conversion/) connects supported scanner sources, JPEG/JPEG 2000/HTJ2K routes, governed metadata and DICOM VL WSI output.
- **Satellite and aerial imagery:** JPEG 2000 APIs provide tile, region, and reduced-resolution access for large images.
- **AI and computer vision:** [GPU image decoding](https://frames-sg.com/gpu-image-decoding-ai/) delivers supported JPEG 2000 or HTJ2K batches to Burn, Metal, CUDA, MPSGraph and optional PyTorch/NumPy integrations.
- **Image services and science:** Applications can build thumbnails, tiled viewers, image-processing services, and scientific pipelines with scaled, region, and native-component access.

## Python bindings

Use the Rust codecs from Python, with NumPy and PyTorch output. See the documentation for installation and supported inputs.

- **Image decoding:** The `j2k` extension decodes supported JPEG 2000 and HTJ2K images into NumPy arrays or PyTorch tensors. GPU-enabled builds can decode supported inputs directly into PyTorch tensors on Apple GPUs or NVIDIA GPUs. [Codec bindings and build instructions](https://github.com/frames-sg/j2k/blob/main/crates/j2k-python/README.md).
- **Installation:** Build the `j2k` extension with Maturin in an existing Python environment. Enable Metal for Apple GPU output or CUDA for NVIDIA GPU output. See the [build instructions and platform requirements](https://github.com/frames-sg/j2k/blob/main/crates/j2k-python/README.md#build-and-install).

## Formats and libraries

- **JPEG 2000 / HTJ2K:** Safe Rust APIs through [`j2k`](https://frames-sg.com/j2k/) for inspection, decoding, encoding, recoding, and JP2/JPH still-image workflows.
- **JPEG XR / JXR:** [Full-image, region, and batch decoding](https://frames-sg.com/rust-jpeg-xr-codec/) through `jxr`, including high-bit-depth output, alpha, and ICC metadata, plus optional Metal or CUDA reconstruction.
- **JPEG:** [Rust JPEG inspection, decoding and encoding](https://frames-sg.com/rust-jpeg-codec/) through `j2k-jpeg`, with optional Metal and CUDA adapters for supported paths.
- **JPEG to HTJ2K:** [Coefficient-domain transcoding](https://frames-sg.com/jpeg-to-htj2k-transcoding/) through `j2k-transcode` for supported baseline JPEG inputs.
- **Machine learning:** [Batch decoding for AI pipelines](https://frames-sg.com/gpu-image-decoding-ai/) through `j2k-ml` and related integrations.

## GPU acceleration

Apple Metal provides GPU acceleration on macOS. NVIDIA CUDA provides GPU acceleration on supported NVIDIA hardware. The J2K workspace’s CUDA kernels are written in Rust and compiled with cuda-oxide. Resident-output APIs let applications process supported decoded images on the GPU without copying them back to the CPU. CPU implementations are available on Linux, macOS, and Windows. Backend coverage depends on the format, operation, image, and requested output. See the [Apple Metal guide](https://frames-sg.com/j2k/metal-jpeg2000-rust/) and [NVIDIA CUDA guide](https://frames-sg.com/j2k/cuda-jpeg2000-rust/) for integration details. For exact J2K coverage, use the [public support matrix](https://github.com/frames-sg/j2k/blob/main/docs/public-support.md). For JPEG XR coverage, use the [JXR support guide](https://github.com/frames-sg/jxr/blob/main/docs/support.md).

## Licensing and source

Frames libraries are open source under MIT or Apache-2.0 licenses. Source repositories are published by the [Frames GitHub organization](https://github.com/frames-sg).

## Integration and support

Get Frames working in your application. We offer integration help and custom development, including priority fixes for codec issues. If performance is the problem, we can profile your workload and work toward an agreed target.

- **Integrate Frames:** Tell us what you’re building and where we can help. We can work with you on the integration and the codec changes your application needs.
- **Custom development:** Bring us the file you’re having trouble with or the workload you want to improve. We can investigate it with you and develop a fix based on your images and software.

Send a short description of your project to [hello@frames-sg.com](mailto:hello@frames-sg.com). We’ll talk through what you need and work out how we can help.
