How arrays become pixel formats¶
LittleCMS describes pixels with a 32-bit format word: color space, channels, extra (alpha) channels, bytes per sample, float or integer, planar or interleaved. python-lcms2 derives it from your array so you never write one.
Array |
Format |
|---|---|
dtype |
1 / 2 bytes per sample, integer |
dtype |
half / single / double float |
other dtypes |
|
last axis = profile channels |
no alpha |
last axis = profile channels + 1 |
one extra channel, copied to the output unchanged |
1-channel (gray) profile |
|
Python lists: all integers → uint8 (or uint16 past 255); any float → float64.
Value ranges follow LittleCMS and Photoshop: integer RGB/CMYK use the full integer range; float RGB is 0–1;
float CMYK (and other ink spaces) is 0–100 percent ink everywhere — profiles, ICCSpace and
spaces.cmyk; float Lab is real L*a*b* (L 0–100); float XYZ has Y = 1 for the white.
Profiles generated from a lcms2.spaces color space take that space’s own values (OKLab a/b about ±0.4,
hue in degrees), the same values lcms2.convert() uses.
Output dtype: the input dtype, except integer input converted to Lab or XYZ gives float64, since encoded
integer Lab is rarely what you want. out_dtype= overrides.
Memory layout: any strides work; non-contiguous input is copied once. Output is C-contiguous with the input’s leading shape.
A Transform without explicit formats creates one LittleCMS transform per distinct input format and caches
it, so calling the same Transform on uint8 and float32 images both work.