ColorTarget

sealed class ColorTarget(source)

Where a decode leaves the colours of its samples, as Android's ImageDecoder.setTargetColorSpace sets it.

  • Source keeps the samples as the file stores them, whatever colour space its ColorProfile declares, which is what every decode does by default.

  • Srgb converts them to sRGB through what the file declares, for drawing on a screen that shows sRGB, as browsers convert: its ICC profile, its H.273 code points (PNG's cICP, an AVIF's nclx, a JPEG XL header's colour encoding), or PNG's gAMA and cHRM, in the order ColorProfile gives. HDR (PQ or HLG) is tone-mapped to SDR as mpv's libplacebo maps it: BT.2408's 203 cd/m² diffuse white becomes sRGB white, highlights roll off by BT.2390's curve from the content's peak, and a colour sRGB cannot show desaturates toward its own luminance. Samples deeper than 8 bits convert at their own precision before an 8-bit decode narrows them. A file that declares nothing, or declares sRGB, comes back as Source would give it.

Inheritors

Types

Link copied to clipboard

The samples as the file stores them.

Link copied to clipboard
data class Srgb(val intent: RenderingIntent = RenderingIntent.Perceptual) : ColorTarget

Converted to sRGB with intent, perceptual by default as browsers and lcms2's tools convert.