/HDRImageViewer

UWP app to view high dynamic range (HDR) and wide color gamut (WCG) images.

Primary LanguageC++MIT LicenseMIT


HDR + WCG Image Viewer

Logo

Windows 10/11 app for viewing high dynamic range (HDR) and wide color gamut (WCG) images at full quality on a capable HDR10 or WCG display.

Get app from the Microsoft Store · App support page
NOTE: Currently the Store version lags significantly behind this repo.


About the Project

This is a Universal Windows Platform (UWP) app that uses DirectX Advanced Color to decode and render HDR image formats at the best available quality on a supported HDR10 display.

Supported formats include:

  • OpenEXR
  • Radiance RGBE (.hdr)
  • JPEG XR (including Xbox and Windows variants)
  • HEIC with HDR10/BT.2100 data
  • AVIF with HDR10/BT.2100 data
  • EXPERIMENTAL: Apple HDR GainMap images using HEIC and JPEG
  • JPEG, PNG and other SDR formats with wide gamut and/or color profile information

The app performs luminance display mapping/tone mapping to adapt an HDR image to the capability of the display. It also includes some useful tools for HDR developers such as rendering the image luminance as a colorized heatmap, or forcing an image to be interpreted with a specific colorspace (for example, PNG images encoded as HDR10).

Running the app

The minimum requirements to run the app are a recent version of Windows 10 or 11 (19H1 or greater) and a GPU that supports DirectX 11. You should also update your graphics (WDDM) driver.

Display hardware

If you use an SDR display the app will use tone mapping to render any HDR images to the best of its ability. You will obviously need a Windows-compatible HDR display to experience a benefit from HDR images.

HDR displays vary greatly in quality - low quality models offer no real benefit over SDR and in fact often screw up color and graphics rendering as to make it look worse than SDR. For best results a certified display is strongly recommended, including:

Command line usage

If you are loading an image using the -input argument you must invoke HDRImageViewer from the directory containing the image you wish to load - UWP apps launched from a command line only have access to files within the working directory.

Parameters

-f Start in fullscreen mode

-h Start with UI hidden

-forcebt2100 Force images to use BT.2100 PQ color space (BT.2020 primaries, ST.2084/PQ transfer function)

-input:filename Load filename

Note: Filename must be relative to the current working directory as HDRImageViewer only has access to that directory.

-colorprofile:r_x,r_y,g_x,g_y,b_x,b_y,w_X,w_Z,gamma Use a custom color space defined by RGBW primaries and gamma

  • r_x,r_y,g_x,g_y,b_x,b_y: CIExyY x and y coordinates of the red/green/blue primaries.
  • w_X,w_Z: CIEXYZ X and Z coordinates of the whitepoint, normalized to Y = 1.0
  • gamma: Enumeration, use 0 for 2.2/sRGB, 1 for 1.0/linear. BT.2100 PQ transfer function is not yet supported, use -forcebt2100 instead.

-rendereffect:[effect] Force a render effect. Valid values are:

  • none
  • hdrtonemap
  • sdroverlay
  • maxluminance
  • luminanceheatmap

Example

HDRImageViewer.exe -f -h -input:myimage.jxr

Compiling the app

You'll need Visual Studio 2022 with the following workloads installed:

  • Desktop Development with C++
  • Universal Windows Platform Development
    • In Optional Components, make sure C++ (v143) Universal Windows Platform tools is checked.

(VS2019 probably works, too, but this is untested)

Manually including the libheif package

The repo contains a copy of libheif built using vcpkg and exported into a local NuGet package at \libheif-vcpkg\vcpkg-export-20210528-221932.1.0.0.nupkg. Libheif is consumed by HDRImageViewer as a dynamic link library to comply with requirements of the LGPL license.

You must manually add the libheif-vcpkg directory to Visual Studio's list of NuGet package repositories:

  1. In Visual Studio, go to Tools > NuGet Package Manager > Package Manager Settings.
  2. In the Package Sources page, add the libheif-vcpkg directory as a new source.

Visual Studio should show something similar to:

libheif-vcpkg local Nuget package source

Acknowledgments

This app includes source, object code, and/or techniques from many excellent sources, including but not limited the following:

3rd party licenses can be found in the 3rdparty directory.