current state of producing photos for HDR display?

Started 4 months ago | Discussions thread
spider-mario Senior Member • Posts: 1,030
Re: current state of producing photos for HDR display?

Brian Kimball wrote:

Here's a high-level summary of what I think I know about photos made for HDR display. It would be much appreciated if you could tell me if I'm still misunderstanding things:

Generally speaking, HDR-enabled still photos...

  • have no specific color space requirement

Correct, they often use Rec. 2020 primaries but they don’t have to. In fact, even when encoded in Rec. 2020, HDR content is often restricted to the P3 gamut anyway as that’s what current mastering displays are capable of.

  • have no specific bit depth requirement

Right, although at least 10 bits, ideally 12, is usually recommended to avoid quantization artifacts, as illustrated in this graph from this thread.

  • employ a special gamma encoding that either generates an absolute intended brightness of a pixel (PQ) or a brightness that is relative to whatever display and viewing environment is being used (HLG)
  • or alternatively are in a special 16 or 32-bit .EXR format which is linear
  • or alternatively are in even more obscure formats that are unlikely to be usable outside of very specialized viewers

This all matches my understanding.

  • PQ and HLG were both developed for HDR video first, many years ago. Only now is support for them starting to show up in bleeding-edge versions of JPG and PNG specs. Who knows when or if Apple/Google/Microsoft/Adobe will ever support HDR JPGs or PNGs.

The current version of Chrome should already support HDR PNGs (such as this one), and Chrome 108, currently in “Canary” and due for release on 29 November 2022, should support HDR ICC profiles (such as the one in this JPEG).

  • .HEIF and .AVIF already support PQ & HLG, but software support for producing one's own photos in these filetypes is still quite limited> * this may be the result of patent/royalty/political issues between large tech companies

If one has a PQ or HLG image already, encoding it to AVIF can be done with free and open-source software. Assuming that “input.png” contains pixel data in Rec. 2020 PQ (not necessarily with any HDR signaling at all), the following command compresses it to AVIF:

$ avifenc --ignore-icc --cicp 9/16/9 -d 12 input.png output.avif [other compression options…]

For JPEG XL, it would be more convenient to start from a PPM file, and do:

$ cjxl -x color_space=RGB_D65_202_Rel_PeQ input.ppm output.jxl

For HEIF, I haven’t really found a satisfactory solution yet.

So on a practical level, to produce a photo ready for HDR display today, one must...

  • shoot SOOC in HEIF format on a modern iPhone from the past 2-3 years. This will use HLG
  • shoot SOOC in HEIF format on a Canon 1DXmIII, R5, or R6. This will use PQ
  • possibly shoot SOOC in HEIF format on some Android phones. Unclear here.
  • shoot raw/jpg/whatever, edit in Affinity Photo, export as .EXR

A note on the last point: having produced such an EXR file, the reference JPEG XL implementation contains a command-line tool that can be used to convert such OpenEXR files to PQ. (It also includes tools for conversion between PQ and HLG.)

  • shoot raw/jpg/whatever:> 1. with any camera
    1. edit & export in any editor
    2. open that file in Davinci Resolve
    3. perform magic
    4. end up with an HDR-enabled .AVIF file that is only viewable in... Chrome?

What DaVinci Resolve gives me, more specifically, is a 16-bit TIFF file in the colorspace of my choosing. From there, it is up to me to compress it to AVIF or something else, with the appropriate metadata.

And finally, for proper viewing of HDR-enabled photos, one must:

  • have an HDR display
  • view them in Apple Photos (if HEIF), or
  • view them in Google Chrome (if AVIF), or
  • somehow view them on an HDR TV, or

The only solution I have found to view them on my TV is to encode them as a video. FFmpeg can do it, e.g. this creates a 30-second video of just one image, albeit without tone-mapping metadata:

$ ffmpeg -loop 1 -i input.ppm -t 30 -c:v libx265 -crf 12 -pix_fmt yuv420p10le -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc output.mkv

  • if .EXR, view them in in tev or some other compatible viewer or
  • view them in .... what else?

Personally, tev is indeed my EXR viewer of choice. Sadly, I don’t know of many options other than Chrome and tev to view HDR stills at the moment.

 spider-mario's gear list:spider-mario's gear list
Canon G1 X III Olympus TG-6 Olympus E-M1 II Olympus E-M1 III Canon EOS R6 +16 more
Keyboard shortcuts:
FForum PPrevious NNext WNext unread UUpvote SSubscribe RReply QQuote BBookmark MMy threads
Color scheme? Blue / Yellow