GainMap

class GainMap(val jpeg: ByteArray, val primaryIso: ByteArray? = null)(source)

The gain map of an Ultra HDR JPEG (#130): a second, small JPEG after the main image that tells an HDR screen how much brighter each area of the photo may be drawn. ImageKodec.readMetadata finds it through the Multi-Picture Format segment of the main image, and an encodeJpeg with the metadata writes it again after the new main image, with an MPF segment that points to it.

A gain map covers the whole main image at any resolution, so it stays valid while the main image keeps its aspect ratio and its orientation. ImageMetadata.upright turns it with the pixels; an encode of a bitmap of another aspect ratio, a crop for one, leaves it out together with the HDR fields of the XMP packet.

Throws

when jpeg is not a JPEG whose size can be read

Constructors

Link copied to clipboard
constructor(jpeg: ByteArray, primaryIso: ByteArray? = null)

Properties

Link copied to clipboard
val height: Int

The height of the gain map, in pixels.

Link copied to clipboard

the gain map image, a whole JPEG file with its own hdrgm XMP packet or ISO 21496-1 segment, which hold its parameters.

Link copied to clipboard

the body of the ISO 21496-1 APP2 segment of the main image, which names the version of the gain map metadata, or null when the main image has none.

Link copied to clipboard
val width: Int

The width of the gain map, in pixels.

Functions

Link copied to clipboard
open override fun toString(): String