Skip to content

@mbtech-nl/bitmap / ImageRenderOptions

Interface: ImageRenderOptions

Defined in: types.ts:44

Properties

PropertyTypeDescriptionDefined in
autoLevels?booleanStretch the luminance histogram so the darkest visible pixel becomes 0 and the brightest becomes 1, before gamma and threshold/dither. Applied per-image; flat (all-same-value) inputs are passed through. Default falsetypes.ts:79
dither?boolean | DitherMethodDither method. - false (default): no dithering, hard threshold at threshold. - true: alias for 'floyd-steinberg' (backward compatible with v1.0). - method string: use the named algorithm. Default falsetypes.ts:59
gamma?numberGamma correction applied to luminance before threshold/dither. Output = pow(L, gamma). - gamma < 1 brightens midtones. - gamma > 1 darkens midtones. - gamma === 1 is a no-op. Must be a finite positive number; non-finite or non-positive values throw. Default 1types.ts:90
invert?booleanInvert the output bitmap. Default falsetypes.ts:65
luminanceWeights?LuminanceWeightsRGB → luminance weights. - 'bt709' (default): 0.2126 / 0.7152 / 0.0722 — current behaviour. - 'bt601': 0.299 / 0.587 / 0.114 — older NTSC standard. - tuple: custom non-negative weights; must sum to ~1.0 (validated, ±1e-6 tolerance). Default 'bt709'types.ts:99
rotate?0 | 90 | 180 | 270Rotate the rendered bitmap. Applied last, after threshold/dither. Default 0types.ts:71
threshold?numberThreshold for black/white conversion (0–255). Ignored when dither is set to a method or true; dither methods always quantise at the midpoint. Default 128types.ts:50

Released under the MIT License.