File types · Explainer

The HDR file (.hdr, .pic)

An HDR file is usually a Radiance RGBE image: a compact high-dynamic-range format that packs each pixel into 4 bytes, three colour values sharing one exponent, and the standard way to distribute HDRI environment maps for 3D lighting. This guide explains how the encoding works with a worked example, what's in the header, how to open and convert one, and how to tell it apart from other files that use .hdr.

At a glance

Full name
Radiance RGBE image, also called Radiance HDR or a Radiance picture
Extensions
.hdr, .pic; also .rgbe and .xyze
MIME type
image/vnd.radiance, registered with IANA in 2009
Kind
Binary raster image after a short text header; 32 bits per pixel, high dynamic range; run-length encoded
Standard or owner
Defined by Greg Ward's Radiance lighting simulation software, from Lawrence Berkeley National Laboratory; no standards body
First released
With Radiance, which Ward began in 1985; the encoding was described in "Real Pixels" in Graphics Gems II (1991)
Pixel format
8-bit red, green and blue mantissas plus a shared 8-bit exponent; no alpha channel
Magic number
23 3F 52 41 44 49 41 4E 43 45 0A ("#?RADIANCE" and a newline); some programs write #?RGBE
Opens with
Photoshop, GIMP, Blender, Affinity Photo, HDR viewers such as tev; game engines import it; browsers can't display it
Not to be confused with
ENVI header files (plain text starting ENVI), Analyze medical image headers, and "HDR photos" from phones, which are JPEG or HEIC

The basics

What is an HDR file?

A .hdr file is most often a Radiance RGBE image. Greg Ward created the format for Radiance, the lighting simulation software he began writing at Lawrence Berkeley National Laboratory in 1985, to store how much light reaches each pixel rather than what a screen should show. It was the first widely used high-dynamic-range image format, and for years the only one.

Its trick is the shared exponent: each pixel stores three 8-bit numbers for red, green and blue plus one 8-bit exponent that scales all three. That gives an enormous range of brightness in 4 bytes per pixel, the same size as an 8-bit RGBA PNG before compression. Today the format's biggest use is HDRI environment maps: panoramic photos of real places, used to light and surround 3D scenes in Blender, game engines and product rendering.

Three things a Radiance .hdr file is not:

  • Not an "HDR photo" from a phone. Phones save HDR pictures as JPEG or HEIC files, sometimes with a gain map for HDR screens.
  • Not an ENVI or Analyze header. Remote-sensing and medical imaging software use .hdr for a header file that sits next to the image data.
  • Not an OpenEXR file. EXR is the other common HDR format, with more precision, alpha and layers.

Anatomy

What's inside an HDR file

A Radiance file is a few lines of text (an identifier, settings, an empty line and the image size) followed by binary pixel data. Below is every byte of a 59-byte file we made for this page with OpenImageIO: a strip 8 pixels wide and 1 high, whose right half is four times as bright as its left half. It isn't offered for download; the layout follows the Radiance picture file format notes.

strip.hdr (hex, 59 bytes)
strip.hdr: 8 × 1 pixels, 59 bytes

23 3F 52 41 44 49 41 4E 43 45 0A     #?RADIANCE↵
46 4F 52 4D 41 54 3D 33 32 2D 62     FORMAT=32-bit_rle_rgbe↵
69 74 5F 72 6C 65 5F 72 67 62 65 0A
0A                                   ↵  (empty line: end of header)
2D 59 20 31 20 2B 58 20 38 0A        -Y 1 +X 8↵

02 02 00 08                          scan line marker: 2, 2, width 8
88 80                                red mantissas:   8 × 128
88 40                                green mantissas: 8 × 64
88 20                                blue mantissas:  8 × 32
84 81  84 83                         exponents: 4 × 129, then 4 × 131

decoded:
pixels 1 to 4   R 1.0  G 0.5  B 0.25
pixels 5 to 8   R 4.0  G 2.0  B 1.0
  1. 1#?RADIANCE

    The identifier

    The first line names the program type. #?RADIANCE is the standard; some programs write #?RGBE, which not every reader accepts. Radiance octree files start the same way, so a reader should also check the FORMAT line.

  2. 2FORMAT=32-bit_rle_rgbe

    Header variables

    Lines of the form NAME=value. FORMAT is 32-bit_rle_rgbe for RGB pictures or 32-bit_rle_xyze for CIE XYZ. Others are optional: EXPOSURE (a multiplier already applied to the pixels), PIXASPECT, PRIMARIES, COLORCORR, and the commands or software that made the file.

  3. 30A

    End of header

    An empty line ends the header. Everything before it is plain text you can read with head -c 200 file.hdr.

  4. 4-Y 1 +X 8

    The resolution string

    1 row, 8 columns. -Y means rows run from top to bottom and +X that pixels run left to right, the usual layout. Other signs and orders flip or rotate the image (see below).

  5. 502 02 00 08

    A run-length encoded scan line

    Two bytes of 2 and the width as a 16-bit number mark a scan line in the newer run-length format. Its 8 pixels are then stored one component at a time: all reds, all greens, all blues, all exponents.

  6. 688 80

    A run

    A code byte above 128 is a run: 0x88 is 136, so the next byte, 0x80 (128), repeats 136 − 128 = 8 times. A code of 128 or less is followed by that many literal bytes.

  7. 784 81 84 83

    The exponents

    Four pixels with exponent 129, then four with 131. The mantissas are the same in both halves: only the exponent changed, and +2 on the exponent means four times as bright.

Under the hood

How RGBE works: a worked example

To store a pixel, take its largest component and write it as a fraction between 0.5 and 1 times a power of two. That power, plus 128, becomes the exponent byte. Each component is then divided by the same power of two and multiplied by 256 to give its 8-bit mantissa. Here's the example from the Radiance documentation, (1.0, 0.5, 0.25):

rgbe-example.txt
encode (1.0, 0.5, 0.25)
  largest value:  1.0 = 0.5 × 2^1      exponent byte = 1 + 128 = 129
  mantissas:      value × 256 / 2^1    1.0 → 128, 0.5 → 64, 0.25 → 32
  stored bytes:   80 40 20 81

decode 80 40 20 81
  value = mantissa × 2^(exponent − 136)
  128 × 2^(129 − 136) = 128 / 128 = 1.0
   64 × 2^−7 = 0.5      32 × 2^−7 = 0.25

four times as bright, (4.0, 2.0, 1.0)
  4.0 = 0.5 × 2^3                      exponent byte 131
  stored bytes:   80 40 20 83          same mantissas, exponent + 2

What follows from this design:

  • Huge range. The exponent byte runs from 1 to 255, covering about 76 orders of magnitude, far more than any real scene. An exponent of 0 means black.
  • About 1% precision. The largest component always gets 8 significant bits, so it's stored to within 1%. That's fine for light, which the eye judges in ratios.
  • Weak colours next to strong ones lose detail. In a pixel like (100, 0.01, 0), the exponent is set by the 100, and 0.01 rounds to 0. Saturated, very bright colours can show slight colour noise.
  • No negative values and no alpha. Every component must be zero or positive, and there's no fourth channel for transparency.
  • Small rounding differences. Radiance's own decoder adds 0.5 to each mantissa before scaling, to land in the middle of the rounding step; many other readers don't, so values can differ by a fraction of a percent between programs.

Format details

The header, orientation and run-length encoding

The header is plain text, one setting per line, ended by an empty line. Radiance's own tools also record the commands that made or processed the picture, so a header can be a small history of the image. Then comes the resolution string, which sets both the size and the orientation:

Resolution stringMeaning
-Y 1024 +X 2048The standard: 1,024 rows from top to bottom, 2,048 pixels per row from left to right
+Y 1024 +X 2048Rows from bottom to top: the image is flipped vertically
-Y 1024 -X 2048Pixels from right to left: flipped horizontally
+X 2048 -Y 1024 and other X-first formsStored in columns instead of rows: the image is rotated by 90 degrees

Almost every file uses the standard form, and some readers support nothing else. The pixels themselves are usually compressed with the newer run-length encoding: each scan line starts with 02 02 and its width, and the red, green, blue and exponent bytes are each encoded separately, in runs (code above 128) and literal stretches (code up to 128). Separating the components makes runs much more likely, because exponents and mantissas change at different rates.

  • Only widths from 8 to 32,767 are run-length encoded. Narrower or wider images are stored as flat 4-byte pixels.
  • Older files (Radiance 1.4 and earlier) used a different scheme, in which a special pixel repeats the previous one. Readers still support it.
  • It's lossless, but the RGBE conversion before it isn't: a floating-point image converted to .hdr keeps 8 significant bits per pixel.

Uses

HDRI environment maps

An HDRI (high-dynamic-range image) environment map is a 360° panorama, usually stored as an equirectangular image twice as wide as it is high, made by merging photos taken at several exposures. Because the file keeps the true brightness of the sun, sky and lamps, a 3D renderer can use it as the light source: objects get realistic reflections and shadows that match the place where the panorama was shot.

  • In Blender: add an Environment Texture node to the World and load the .hdr file.
  • In game engines: Unity and Unreal Engine import .hdr panoramas for skyboxes and image-based lighting.
  • Online libraries of free HDRIs commonly offer each panorama as both .hdr and .exr, in sizes from 1K to 16K or more.

Why .hdr rather than EXR for this? The files are reasonably small, every 3D application reads them, and 1% precision is plenty for lighting. EXR wins when you need alpha, more precision or more compression options.

Identify

Other files called .hdr, and "HDR photos"

If a .hdr file won't open as an image, check its first bytes in a text editor or with head -c 16 file.hdr:

What it isHow it startsWhat to do
Radiance RGBE image#?RADIANCE or #?RGBEOpen it in an image editor or 3D app
ENVI header (remote sensing)The word ENVI, then text lines such as samples = 1024 and bands = 224It describes a separate raw data file with the same name; open the pair in ENVI, QGIS or GDAL-based tools
Analyze 7.5 header (medical imaging)Binary, 348 bytes, next to an .img fileOpen the pair in a medical imaging viewer
Something elseAnything elseSome programs use .hdr for their own header or data files; check what made it

"HDR" on a phone means something different. A phone's HDR mode merges several exposures into one photo saved as a normal JPEG or HEIC. Newer formats such as Android's Ultra HDR add a gain map inside the JPEG, so HDR screens can show brighter highlights while ordinary viewers see the standard picture. None of these are .hdr files.

Comparison

HDR vs EXR, PFM and 16-bit TIFF

Radiance HDROpenEXRPFM16-bit TIFF or PNG
Bytes per RGB pixel, uncompressed46 (half) or 12 (float)126
RangeEnormousHalf: about 0.00006 to 65,504; float: enormousEnormous0 to 1 (65,536 levels)
PrecisionAbout 1%About 0.1% (half)Full 32-bit floatFixed steps
AlphaNoYesNoYes
Layers or passesNoYesNoTIFF: pages
CompressionRun-lengthMany, lossless and lossyNoneLossless
Typical useHDRI maps, lightingFilm, VFX, renderingResearch, simple toolsPhoto editing

A 16-bit TIFF or PNG has fine steps but stops at white, so it isn't HDR in the same sense: there's no way to store a value brighter than the brightest the format allows.

Troubleshooting

Common HDR file problems

  • It won't open. The file may start with #?RGBE, which some readers reject; changing that first line to #?RADIANCE in a hex editor usually fixes it. It may also be an XYZE file or not a Radiance image at all (see the table above).
  • It looks too dark or too bright. An HDR image has no single correct brightness. Viewers pick an exposure; adjust it, or apply a tone-mapping operator when converting to JPEG or PNG.
  • It looks flat or washed out. The values are linear light. A viewer that doesn't apply the sRGB curve shows them dark; one that applies it twice shows them pale.
  • It's upside down or rotated. The resolution string isn't the standard -Y … +X …, and the reader ignored it.
  • The sun or lamps look white and flat in an export. Values above 1.0 clip in 8-bit formats. That's expected; the detail is still in the .hdr file.
  • There's no transparency. RGBE has no alpha channel. Use EXR for images that need one.

How to

How to open, edit and convert an HDR file

  • View it: free HDR viewers such as tev let you change the exposure. Photoshop opens .hdr in 32-bit mode, and GIMP (since 2.10) and Affinity Photo open it too.
  • Use it for 3D lighting: Blender, Unity, Unreal Engine and most renderers load it directly as an environment map.
  • Make one: merge bracketed exposures in Photoshop (Merge to HDR Pro), in dedicated HDR software, or render one from Blender.
  • Convert it on the command line: OpenImageIO (pip install OpenImageIO) or ImageMagick.
terminal
# inspect the size and channels
oiiotool --info -v sky.hdr

# HDR to EXR (half float, no loss of range)
oiiotool sky.hdr -d half -o sky.exr

# HDR to an 8-bit sRGB PNG, one stop darker first
oiiotool sky.hdr --mulc 0.5 --tocolorspace sRGB -d uint8 -o sky.png

Like other image files, .hdr files contain no scripts. The text header can name the software, commands and sometimes file paths used to make the image; check it with a text editor before sharing.

Sample files

There are no sample HDR files on this page yet. To make one for testing, run oiiotool input.exr -o output.hdr with OpenImageIO (pip install OpenImageIO) or magick input.png output.hdr with ImageMagick, or save one from Blender.

Put it online

Have an HDR file? Give it a link.

Drop a Radiance .hdr image on 99helpers and it gets its own web address. Browsers can't display it, so anyone who opens the link downloads the file, ready to load into Blender, a game engine or an image editor.

Questions

HDR files, frequently asked

What is a .hdr file?

Usually a Radiance RGBE image: a high-dynamic-range picture that stores each pixel as three 8-bit colour values sharing an 8-bit exponent. It's widely used for HDRI environment maps. The extension is also used by ENVI and Analyze header files.

How do I open an HDR file?

Use Photoshop, GIMP, Affinity Photo or a free HDR viewer such as tev, or load it in Blender or a game engine. Browsers can't display Radiance files.

Is my phone's HDR photo a .hdr file?

No. Phones save HDR photos as JPEG or HEIC, sometimes with an extra gain map for HDR screens. A Radiance .hdr file is a different format, mostly used in 3D graphics and lighting.

What's the difference between HDR and EXR?

Both store high dynamic range. HDR uses 4 bytes per pixel with a shared exponent and has no alpha; EXR uses 16- or 32-bit floats per channel and supports alpha, layers and many compression methods. HDR is simpler; EXR is more precise and flexible.

How do I convert HDR to JPG or PNG?

Open it in an image editor, set the exposure or tone-map it, and export. On the command line: oiiotool sky.hdr --tocolorspace sRGB -d uint8 -o sky.png. Bright areas above 1.0 clip unless you lower the exposure first.

What is an HDRI?

A high-dynamic-range panorama, usually a 2:1 equirectangular image, used to light and surround 3D scenes. HDRIs are commonly distributed as .hdr or .exr files.

Is the HDR format lossless?

The run-length compression is lossless, but converting floating-point values to RGBE rounds them to about 1% precision. For exact values, use EXR with 32-bit float or PFM.

Related formats

Other file types explained

Keep going

Related

Sources

Last reviewed 27 October 2026.