PhoenixKit.Modules.Storage.Hdr (phoenix_kit v2.62.2)

Copy Markdown View Source

Whether a photo carries an HDR gain map: the second picture that tells an HDR-capable screen how far to push the highlights past normal white. An iPhone photo is a normal (SDR) image plus this map; an ordinary renditions pipeline (ImageMagick) keeps the first and drops the second, which is why a rendition looks flat next to the same photo in Photos.

read/1 looks at the file's head only and returns %{} for a photo without one, else

%{"gain_map" => true,
  "container" => "jpeg",              # "jpeg", "heic" or "avif"
  "kinds" => ["apple", "iso21496"],   # which descriptions of it the file has
  "headroom" => 4.974161,             # HDR peak as a multiple of SDR white, or nil
  "gain_map_bytes" => 205482}         # the size of the map's picture, or nil

The kinds:

  • "iso21496" — the ISO 21496-1 marker (iPhone 15 and later, Android 15)
  • "apple" — Apple's own auxiliary hdrgainmap picture and its headroom
  • "ultrahdr" — Google's Ultra HDR / Adobe gain map metadata (hdrgm:), what Android phones write; newer ones write the ISO marker as well

A JPEG keeps the map as a second picture listed in its Multi-Picture directory; a HEIC or AVIF as a tmap item (ISO) or Apple's auxiliary picture. Nothing is decoded.

Summary

Functions

Whether a summary from read/1 describes a photo with a gain map.

The gain-map summary of the image at path, %{} when it has none.

Functions

gain_map?(arg1)

@spec gain_map?(term()) :: boolean()

Whether a summary from read/1 describes a photo with a gain map.

read(path)

@spec read(Path.t()) :: map()

The gain-map summary of the image at path, %{} when it has none.