Types & Enums

Diese Seite ist derzeit nur englisch — die JSDoc-Kommentare in der Engine sind englisch verfasst. Eine deutsche Auto-Generierung folgt, sobald die Methoden mit @apidoc-de-Tags ausgestattet sind. — Zur Übersicht

Numeric enums (BlendMode, Interp, BorderMode, AlphaMode, WarpBorder) and shared type aliases (Color, PadColor, Rect, ImageDims). The interfaces here describe handles owned by the Rust engine; the public API for them lives in the Image API page.

← Zurück zur API-Referenz


Classes

Blend

Constructors

Constructor
new Blend(): Blend;
Returns

Blend

Properties

Property Modifier Type Default value
ColorBurn readonly 7 BlendMode.ColorBurn
ColorDodge readonly 6 BlendMode.ColorDodge
Difference readonly 8 BlendMode.Difference
Exclusion readonly 9 BlendMode.Exclusion
HardLight readonly 5 BlendMode.HardLight
Multiply readonly 2 BlendMode.Multiply
Normal readonly 0 BlendMode.Normal
Over readonly 10 BlendMode.Over
Overlay readonly 3 BlendMode.Overlay
Screen readonly 1 BlendMode.Screen
SoftLight readonly 4 BlendMode.SoftLight

Variables

AlphaMode

const AlphaMode: object;

Alpha adjustment mode for adjustAlpha().

Type Declaration

Name Type Default value Description
Add 2 2 Add value to alpha, clamped to [0..1].
Mul 1 1 Multiply alpha by value (0 = transparent, 1 = unchanged).
Set 0 0 Set alpha directly to value.

BlendMode

const BlendMode: object;

Blend mode for blend() and blendAt().

Type Declaration

Name Type Default value Description
ColorBurn 7 7 Color burn
ColorDodge 6 6 Color dodge
Difference 8 8 Difference
Exclusion 9 9 Exclusion
HardLight 5 5 Hard light
Multiply 2 2 Multiply blend: a * b
Normal 0 0 Weighted average: result = self * (1 - factor) + other * factor
Over 10 10 Porter-Duff "Over" — alpha-aware compositing (fg over bg). factor acts as overall opacity.
Overlay 3 3 Overlay blend: combines Multiply and Screen
Screen 1 1 Screen blend: 1 - (1-a)(1-b)
SoftLight 4 4 Soft light

BorderMode

const BorderMode: object;

Pixel border mode for pad().

Type Declaration

Name Type Default value Description
Constant 0 0 Fill border with a constant color.
Reflect 1 1 Reflect pixels at the edge.
Replicate 3 3 Replicate edge pixels.
Wrap 2 2 Wrap pixels (tile).

Interp

const Interp: object;

Interpolation method used in resize, rotate, and warp operations.

Type Declaration

Name Type Default value Description
Bicubic 2 2 Bicubic — accepted, but resize() currently treats it exactly like Bilinear: both take the filtered path, whose kernel is a triangle. No separate cubic kernel is implemented yet, so this is not "higher quality than Bilinear" — it is the same result. Kept so existing scripts keep running, and so the constant is there when a cubic kernel lands (I-20260908-02).
Bilinear 1 1 Bilinear — smooth, the general-purpose default.
Nearest 0 0 Nearest-neighbor — no filtering. Keeps hard pixel edges.

WarpBorder

const WarpBorder: object;

Out-of-bounds fill mode for warpGrid().

Type Declaration

Name Type Default value Description
Clamp 0 0 Clamp UV to [0,1] — samples the nearest edge pixel.
Transparent 1 1 Return fully transparent (RGBA 0,0,0,0) for out-of-bounds UV.

Type Aliases

AlphaMode

type AlphaMode = typeof AlphaMode[keyof typeof AlphaMode];

Alpha adjustment mode for adjustAlpha().


BlendMode

type BlendMode = typeof BlendMode[keyof typeof BlendMode];

Blend mode for blend() and blendAt().


BorderMode

type BorderMode = typeof BorderMode[keyof typeof BorderMode];

Pixel border mode for pad().


Color

type Color = Pixel | string;

A color value accepted by image and canvas operations.

  • Pixel — direct RGBA color with components ∈ [0..1]
  • string — CSS hex string, e.g. "#rrggbb" or "#rrggbbaa"

GalleryEffect

type GalleryEffect = string | object & Record<string, unknown>;

One effect of a Filter Gallery stack: a gallery filter name, or { filter, ...params }.

Example

`{ filter: "patchwork", squareSize: 6, relief: 12 }`

Interp

type Interp = typeof Interp[keyof typeof Interp];

Interpolation method used in resize, rotate, and warp operations.


PadColor

type PadColor = Color | BorderMode;

A pad/border color value accepted by pad(), padLeft(), etc.

  • Color — a Pixel, a hex string ("#rgb" / "#rgba" / "#rrggbb" / "#rrggbbaa") or a CSS colour name ("tomato", "transparent")
  • BorderMode (number) — Reflect / Wrap / Replicate (no fill color used)

Omitting the argument pads transparent. Anything that does not read as a colour throws instead of filling with something arbitrary.


Rect

type Rect = [number, number, number, number];

Normalized rectangle [x, y, w, h] with all values ∈ [0..1] relative to image dimensions. Use ImageHandle.rectFromPixels(), rectFromCenter(), or rectFull() to construct one.


WarpBorder

type WarpBorder = typeof WarpBorder[keyof typeof WarpBorder];

Out-of-bounds fill mode for warpGrid().

Interfaces

ArtifactRef

A stored artifact, as returned by Engine.writeArtifact.

Properties

Property Type Description
filename string -
id string -
uri string mlcartifact://<id> — pass it to any loader.
virtualPath? string -

ArtifactWriteOptions

Options for Engine.writeArtifact.

Properties

Property Type Description
bitDepth? 16 | 8 8 (default) or 16 bits per channel; 16 only for PNG.
description? string Shown in artifact listings.
expiresHours? number Lifetime; the store's default (24 h) when omitted.
format? "png" | "jpeg" | "webp" | "avif" -
lossy? boolean -
mime? string MIME type; derived from the name when omitted.
quality? number Encoder hints for images, as for img.save().
virtualPath? string Virtual path in the store, e.g. "/reports/2026/chart.png".

DetectFacesOptions

Options for Engine.detectFaces() — forwarded to the underlying facedetect-detect tool plugin. All optional; sensible defaults keep the call site clean for the common case.

Properties

Property Type Description
minSize? number Minimum face size in pixels (square side). Default: 60.
scoreThreshold? number Minimum Pico Q-score. Default: 30. Lower → more (noisier) hits.

FaceDetection

One face detected by Engine.detectFaces(). Coordinates are in pixels, the bounding box is square (Pico cascades only emit square regions), and confidence is the Pico Q-score — values above ~30 are confident detections, below ~10 are likely noise.

Properties

Property Type Description
confidence number Pico Q-score: ~5 = noisy, ~30+ = confident.
height number Side length in pixels (boxes are square).
width number Side length in pixels (boxes are square).
x number Top-left x in pixels.
y number Top-left y in pixels.

FilterInfo

One entry of Engine.filters() — a PhotoCraft filter.

params is PhotoCraft's parameter notation: "key":min..max=default, "key":"a|b|c" (first choice = default), "key":bool, "key":json (colours [r,g,b,a] 0..1 or "#rrggbb").

Properties

Property Modifier Type Description
category readonly string Menu category ("Blur", "Distort", …) or gallery folder ("Artistic", "Texture", …).
categoryLabels readonly Labels The category in both UI languages, e.g. { en: "Blur", de: "Weichzeichnungsfilter" }.
id readonly string Unique id with its source: "os.kuwahara", "pc.filter.blur.gaussianBlur", "ext.<extension>.<name>".
kind readonly "filter" | "gallery" | "stack" "filter", "gallery" (Filter Gallery effect) or "stack" (filterGallery).
label readonly string English display label, e.g. "Gaussian Blur".
labels readonly Labels Display label in both UI languages; de falls back to en.
name readonly string Short name for img.filter() (e.g. "gaussianBlur", "patchwork").
parameters readonly FilterParam[] The same parameters, structured — what the app builds its form from.
params readonly string Parameter notation with ranges and defaults, e.g. {"radius":0.1..1000=1}.
source readonly string "os" (engine), "pc" (PhotoCraft) or "ext.<extension>".

FilterParam

One parameter of a filter in Engine.filters().

Properties

Property Type Description
choiceLabels? Labels[] Display labels of choices, same order.
choices? string[] -
default string | number | boolean | null Default; null = the filter's own default (not sent).
label Labels -
max? number -
min? number -
name string -
required? boolean The filter cannot run without it (Displace's map).
step? number -
type | "number" | "boolean" | "color" | "integer" | "choice" | "seed" | "image" | "json" json = structured data (pins, paths, kernels) — not part of a simple form.
unit? "px" | "%" | "deg" "px" = a pixel measure; scales with the live preview.

ImageDims

Image dimensions returned by Engine.handleDims().

Properties

Property Modifier Type
height readonly number
width readonly number

Labels

A display label in both UI languages; de falls back to en.

Properties

Property Type
de? string
en string

LmsStats

Per-channel mean and standard deviation in log-LMS colour space — the form Reinhard color transfer reads. Returned by Engine.colorStats(); consumed by img.colorTransfer().

Values are not particularly meaningful on their own; treat the struct as an opaque token you can cache and re-apply across many targets that all need to match the same reference look.

Properties

Property Type Description
mean [number, number, number] [L̄, M̄, S̄] in log-LMS.
std [number, number, number] [σ_L, σ_M, σ_S] in log-LMS.

SVGOptions

Options for ImageHandle.toSVG(). All fields are optional — omitted fields use the defaults shown below.

Properties

Property Type Description
colorCount? number Max color clusters. Default: 16
colorMode? "color" | "binary" Color tracing mode. Default: "color"
colorPrecision? number CIEDE2000 color clustering precision. Default: 6
cornerThreshold? number Corner detection angle in degrees. Default: 60
filterSpeckle? number Discard regions smaller than N pixels. Default: 4
gradientStep? number Gradient quantization step. Default: 16
hierarchical? "stacked" | "cutout" Layer composition mode. Default: "stacked"
lengthThreshold? number Minimum segment length. Default: 4.0
maxIterations? number Path optimization iterations. Default: 10
pathPrecision? number SVG coordinate decimal precision. Default: 8
pathSimplify? "none" | "polygon" | "spline" Path smoothing mode. Default: "spline"
spliceThreshold? number Splice angle threshold in degrees. Default: 45