Skip to content
Apexify.jsDocs
Apexify.js version v5.4.5

Node / Images Shapes · guide

Professional image filters (ImageFilter[])

Current Apexify.js 6.0.0 documentation for Professional image filters (ImageFilter[]).

apexify.jsRuntime: nodeCURRENTSince 6.0.0

The filters field is a stack of ImageFilter objects. Filters use the shared Sharp/Canvas RGBA pipeline, with channel-changing operations normalized back to RGBA before compositing. They operate on bitmap layers only (not on pure shape vector fills in the same way — shape layers apply filters on the clipped rectangular region before the shape is drawn).


Global tuning

FieldTypeDefaultRole
filterOrder'pre' | 'post''post'Pre draws the fitted image to a temp surface, filters it, then pastes it (skips mask, distortion, mesh warp, post filters, effects, and stroke — see Paint order). Post filters the pixels already painted inside the clip.
filterIntensitynumber >= 01Multiplier applied to current typed intensity / value fields. Studio validates the resulting effective values against each filter’s runtime range.
SOURCEtypescript
typescript
Studio
await painter.createImage(  {    source: './photo.jpg',    x: 0,    y: 0,    width: 640,    height: 480,    fit: 'cover',    filters: [      { type: 'gaussianBlur', intensity: 4 },      { type: 'brightness', value: 12 },    ],    filterIntensity: 1.2,    filterOrder: 'post',  },  buffer);

Filter catalogue (ImageFilter.type)

The runtime validates these ranges before rendering. Visual Studio uses the same contract for input minimums, maximums, steps, defaults, and semantic validation.

typeRuntime parameter(s)Accepted rangeNotes
gaussianBlurintensity0–100Blur radius/strength in pixels.
motionBlurintensity, angle0–101, −3600°–3600°Directional blur.
radialBlurintensity, centerX, centerY0–50, 0–width, 0–heightCentre coordinates are pixels.
sharpenintensity0–10Sharpening strength.
noiseintensity0–1Deterministic noise.
grainintensity0–1Deterministic monochrome grain.
edgeDetectionintensity0–10Edge-emphasis strength.
embossintensity0–10Emboss strength.
invertnoneon/offPresence of { type: 'invert' } means enabled.
grayscalenoneon/offPresence of { type: 'grayscale' } means enabled.
sepianoneon/offPresence of { type: 'sepia' } means enabled.
pixelatesize, optional x, y, width, heightsize: integer 1–max(width,height); region must stay inside the filtered surfacePixelates the whole image by default, or only the selected rectangular region when region fields are provided.
brightnessvalue−100–100Percentage-style brightness adjustment.
contrastvalue−100–100Percentage-style contrast adjustment.
saturationvalue−100–100Percentage-style saturation adjustment.
hueShiftvalue−3600°–3600°Hue rotation; rendering wraps the angle modulo 360°.
posterizelevelsinteger 2–256Number of color levels.

Parameterless filters are boolean by presence. invert, grayscale, and sepia do not accept an intensity, value, radius, or other numeric field. Visual Studio exposes them as On/Off controls.

Pixelate a selected region

SOURCEtypescript
typescript
Studio
{ type: 'pixelate', size: 16, x: 120, y: 80, width: 320, height: 180 }

x / y are the top-left pixel of the region. width / height default to the remaining surface size. Studio dynamically tightens the width/height maximum when X or Y changes, so the region cannot extend beyond the image/canvas bounds.

The typed stack does not use radius for Gaussian/motion/radial blur, size for grain, or angle for emboss. Those stale/extra parameters are rejected by Studio semantic validation.


Combining filters

  • Order matters: filters run first → last as listed.
  • Filters run through the shared RGBA raster pipeline; channel-changing filters such as grayscale are normalized back to RGBA before compositing.
  • Prefer filterOrder: 'post' when you need stroke, effects, mask, or distortion in the same layer — pre exits before those stages.

Shape layers

When source is a ShapeType, filters are applied inside drawShape on the width × height clip region before painting the vector shape. filterOrder and filterIntensity from ImageProperties are not applied on that path — pass concrete intensity / value on each ImageFilter.


Next steps