Alternative University

Computer Science

Raster Image Storage

Higher Precision Extended Range

XRH File Format 4.0

The XRH file format (with  .xrh  file name extension) is a simple standard royalties-free file format for storing and archiving extended dynamic range raster image data.

XRH stores higher precision extended range still images.  The images could be any spatially correlated rectangular raster data, such as photographs, or geographic elevation data, etc. Each image contains one or more channels (also called image planes or components).

Extended dynamic range images are images that store more than 8 bits per channel. The number of bits per channel is called precision. Extended range images have higher precision.

Color sample values are stored as natural (linear) color values, because higher precision makes sample values more dense (eliminating the need to nonlinearly spread sample values).

The XRH file format is intended to be used for data transfer, processing and archiving purposes, not as a motion picture format.


In an XRH file, each image channel of samples is stored compressed. Each channel can have its own Compression Type. The following Compression Types are currently supported:

Zebra is a lossless compression method using ZST to store Byte Channels of multi-byte samples: for example, four Byte Channels per 32-bit image channel, eight Byte Channels per 64-bit image channel, etc.

SZMOD is a lossy compression method that directly compresses 32-bit and 64-bit floating point samples, without requiring encoding filter steps. It is a modular port of the SZ 2.1 compression method that uses 2nd-order Lorenzo prediction:

“we successfully leverage adaptive parameter optimization techniques with a series of optimization strategies on data prediction, which can significantly improve the compression quality for SZ with the same level of data distortion.”
Kai Zhao, Sheng Di, et al., HPDC ’20, June 23–26, 2020, Stockholm, Sweden [DOI]

JP2K is a lossy compression method for 24-bit samples (72 bits per pixel for an RGB image). It is a JPEG 2000 code stream:

“a JPEG2000 code-stream is entirely self-contained… a JPEG2000 code-stream may stand alone, may be wrapped by one of the three JPEG2000 file formats, or may be contained in some other standard or proprietary file.”
Taubman & Marcellin, JPEG2000: Image Compression Fundamentals, Standards and Practice

In theory, the JPEG 2000 standard allows sample precision to be higher than 24 bits per channel. But in practice, current JPEG 2000 implementations only support up to 24 bits per channel. This XRH version defines a method for converting 32-bit floating point numbers to 24-bit encoding for use with JPEG 2000 code streams.

Source Code

Free proof-of-concept C source code for reading and writing XRH files is provided with Example Images (see below).

Next Page: Data Types >

XRH 4.0 File Format
Page 1 : 
Page 2 : 
Page 3 : 
Page 4 : 
Page 5 : 
Page 6 : 
Page 7 : 
Page 8 : 
Page 9 : 
Page 10 : 
Page 11 : 
Page 12 : 
Introduction (this page)
Data Types
File Layout & Header
Custom Properties
Channel Names
Zebra Compression
SZMOD Compression
JP2K Compression
Color Transformations
Example Images