LibUltraHDR

After research, it was necessary to explore some possible workflows and to create tools for a project in preparation. Based on Greg Benz’s preliminary work on HDR support, LibUltraHDR was the most sensible candidate for further experimentation.

LibUltraHDR

LibUltraHDR is primarily a library for UltraHDR content. The format itself is comparable to MPO. There is a primary (SDR) image, which is also used as a fallback for software without UltraHDR support, and a secondary image in the metadata, the so-called gain map. This maps the luminance gain to be applied to the SDR. More information on how gain maps work can be found at Adobe.

Technical documentation is available at Android Developers.

Status

Greg Benz and others are currently working on promoting support for the format among relevant open source projects:

There are also some first websites with support:

Manual conversion with ffmpeg

Since the release of version 0.8 of libultrahdr the command line options have changed, here is the current (May 2024) version. It is important that:

  • The dimensions of the input image are known (X, Y)
  • The dimensions are divisible by two (even)

In the first step, a YUV representation of the input image must be generated, this is used as a gain map, i.e. as a definition of the gain.

ffmpeg -i input.jpg -filter:v format=p010 output.yuv

In the next step, the gain map created can then be used to generate the desired image:

ultrahdr_app -m 0 -p output.yuv -i input.jpg -w X -h Y -a 0

In the coming months it can be expected that the somewhat esoteric YUV format will either be easier to generate or can be dispensed with altogether.

Docker Image

There is now also a Docker image that provides the latest version of libultrahdr together with ImageMagick with UltraHDR support.

docker pull ghcr.io/cmahnke/hdr-tools:latest

Next steps

Currently, HDR support for HDR images and content is limited to Chrome and its derivative browsers, which have a 75% market share. The HDR support of Firefox, or rather the way to get there, is rather embarrassing - not even HDR video formats are fully supported.

For Chrome-based browsers, however, it should also be possible to add HDR content to HTML canvas elements.

Update 6.7.24

Two examples from my recent vacation:

HDR check

HDR will be activated in the full screen view.