/** * A small ICC profile reader: enough of ICC.1 (v2 and v4) to run the * conversions print production needs — matrix/TRC RGB and gray profiles, * and the lookup-table pipelines of CMYK output profiles (`mft1`, `mft2`, * `mAB `, `mBA `). Pure TypeScript, no WASM: it runs in the layout worker, * the PDF worker and Node alike. * * Pipelines work on normalized values: device channels in 0..1, and the * PCS as the profile encodes it (Lab or XYZ, also normalized 0..1). The * transform layer (`transform.ts`) turns that PCS into real Lab/XYZ. */ export type IccColorSpace = 'RGB' | 'CMYK' | 'GRAY' | 'Lab' | 'XYZ' | 'other'; export type IccPcs = 'Lab' | 'XYZ'; /** A normalized channel tuple; 0..1 per channel. */ export type Channels = number[]; export type Pipeline = (input: Channels) => Channels; /** Which PCS encoding a pipeline's PCS side uses. v2 16-bit Lab (`mft2`) * puts L* 100 at 0xFF00; v4 (`mAB `/`mBA `) at 0xFFFF; 8-bit (`mft1`) at * 0xFF. */ export type PcsEncoding = 'lab-v2' | 'lab-v4' | 'lab-8' | 'xyz'; export interface LutPipeline { run: Pipeline; inputChannels: number; outputChannels: number; pcsEncoding: PcsEncoding; } export interface XYZ { X: number; Y: number; Z: number; } export interface IccProfile { bytes: Uint8Array; /** Major.minor, e.g. 2.2 or 4.3. */ version: number; deviceClass: string; colorSpace: IccColorSpace; pcs: IccPcs; description: string; copyright: string; /** Media white point (`wtpt`), D50-relative. */ mediaWhite: XYZ; /** Media black point (`bkpt`) when the profile has one. */ mediaBlack?: XYZ; /** Device → PCS per rendering intent (0 perceptual, 1 relative, 2 saturation). */ aToB: Partial>; /** PCS → device per rendering intent. */ bToA: Partial>; /** RGB matrix/TRC model: columns rXYZ, gXYZ, bXYZ (row-major 3×3) and * the three tone curves. */ matrixTrc?: { matrix: number[]; trc: [Curve, Curve, Curve]; }; /** Gray TRC model. */ grayTrc?: Curve; /** A short stable hash of the bytes, for caches. */ hash: string; } export type Curve = (x: number) => number; export declare class IccParseError extends Error { } /** Parse an ICC profile. Throws `IccParseError` on anything it cannot read * (a truncated file, an unknown pipeline type in a tag it needs). */ export declare function parseIccProfile(input: Uint8Array | ArrayBuffer): IccProfile; /** The number of device channels of a profile (4 for CMYK). */ export declare function deviceChannels(profile: IccProfile): number; //# sourceMappingURL=icc.d.ts.map