Grok

April 16, 2026 · View on GitHub

badge-license badge-actions badge-oss-fuzz

Grok is an open-source JPEG 2000 codec licensed under AGPL v3.

Performance

Grok is integrated into GDAL. Benchmark results (16 threads, GDAL release build, Fedora 42):

WorkflowGrok (JP2Grok)Kakadu (JP2KAK)OpenJPEG
Spot 6 (Network Storage)35.17 s344 s85 s
Spot 6 (Local Storage)26.92 s30.57 s52.09 s
Pleiades (Region)0.74 s1.41 s4.28 s

Features

  • High Throughput JPEG 2000 (HTJ2K) support
  • Random-access sub-image decoding (TLM + PLT markers)
  • Multi-level tile cache with LRU eviction and compressed chunk caching
  • S3 / cloud storage with network fetch caching and disk spillover
  • ICC color profiles, XML/IPTC/XMP/EXIF metadata
  • Monochrome, sRGB, palette, YCC, extended YCC, CIELab, CMYK
  • 1–16 bit precision
  • JPEG/PNG/BMP/TIFF/RAW/PNM/PAM I/O
  • Linux (x86-64/AArch64), Windows, macOS, WebAssembly

Transcoding (grk_transcode)

grk_transcode rewrites JP2/J2K files at the packet level — no full decompression required. Supported operations:

  • Insert TLM (Tile-part Length) and PLT (Packet Length) markers for random access
  • Inject SOP / EPH markers
  • Truncate quality layers (--max-layers)
  • Strip resolution levels (--max-res)
  • Reorder packet progression (LRCP, RLCP, RPCL, PCRL, CPRL)

Example — add TLM + PLT markers to an existing file:

grk_transcode -i input.jp2 -o output.jp2 -X -L

Testing

  • 2,000+ unit tests
  • Continuous fuzzing via OSS-Fuzz

Language Bindings

Quick Build

git clone --recursive https://github.com/GrokImageCompression/grok.git
cd grok
cmake -B build
cmake --build build --parallel