v7.1.2-34 Latest Stable Release

High Dynamic-Range Images

Learn how ImageMagick supports High Dynamic-Range Imaging (HDRI) with floating-point color spaces, wide gamut rendering, tone-mapping, and formats like OpenEXR. Discover how HDRI enables vivid colors, deep contrast, and accurate brightness across SDR and HDR displays.

quickstart.sh
# Install via your favorite Package Manager
$ brew install imagemagick
# Convert PNG to WebP with compression
$ magick input.png -quality 85 output.webp
# Resize image maintaining aspect ratio
$ magick input.jpg -resize 800x600^ output.jpg
Advanced Imaging

High Dynamic-Range Images

High dynamic-range imaging (HDRI) permits a far greater dynamic range of exposures (i.e. a large difference between light and dark areas) than standard digital imaging techniques. HDRI accurately represents the wide range of intensity levels found in real scenes ranging from the brightest direct sunlight to the deepest darkest shadows. The HDR imaging approach includes:

Floating-Point

Render/capture floating-point color space.

Wide Gamut

Encompass entire perceivable gamut (extend outside [0,1]).

Post-Process

Post-process in extended color space.

Tone-Mapping

Apply tone-mapping for specific display.

ImageMagick supports the Jzazbc colorspace, for applications that require wide color gamut and high dynamic range.

Enabling HDRI in ImageMagick

By default, image pixels in ImageMagick version 7 are stored in a floating-point representation that range from 0 to the quantum depth, which is typically 16-bits (Q16). With HDRI enabled, the pixels can include negative values as well as values that exceed the quantum depth. A majority of digital image formats do not support HDRI, and for those images any pixels outside the quantum range are clamped before they are stored.

The most promising HDR image format is EXR. You must have the OpenEXR delegate library installed to read or write this format. Other HDR formats include TIFF 48-bit integer and 96-bit float formats, HDR, PFM, and ImageMagick's own MIFF format.

To disable the HDRI version of ImageMagick, use this Linux command:

configure-hdri.sh
$ ./configure --disable-hdri

Under Windows, follow the instructions (straightforward for a non-programmer) in a one hour process to build and configure your own executables: Install from Windows Source.

To verify HDRI is properly configured, look for "HDRI" as a feature:

verify-hdri.sh
$ magick identify -version
Features: HDRI

With HDRI enabled, you can now create images with a much wider dynamic range, allowing for more vivid colors and better contrast. It ensures that HDR content can be displayed accurately on compatible devices while maintaining backward compatibility with SDR displays. In this example, you can store the difference between a standard dynamic range (SDR) image and its high dynamic range (HDR) counterpart. Essentially, a gain map captures the additional brightness and color information that HDR provides over SDR:

gain-map.sh
$ magick -define uhdr:hdr-color-gamut=bt709 -define uhdr:hdr-color-transfer=hlg \
  \( img_sdr.tif -depth 8 \)  \( img_hdr.tif -depth 16 \) uhdr:ultrahdr.jpg