Tool plugin — face detect & pixelate (Pigo, pure Go)

Demonstrates a pure-Go Tool Plugin built on Pigo (Pico cascade). Detects faces, then pixelates each face region for privacy. Other modes available: boxes (outline) and blur. Detection metadata (count + bounding boxes) is also emitted as JSON on stderr. ~3.6 MB binary, no CGO, no ONNX runtime.

INPUT
INPUT — Tool plugin — face detect & pixelate (Pigo, pure Go)
Pixelated
Pixelated — Tool plugin — face detect & pixelate (Pigo, pure Go)
JavaScript
// Tool plugin demo — face detection (boxes / pixelate / blur)
// tool_facedetect.js
//!INPUT: INPUT
//!OUTPUT: OUTPUT
//!PARAM: MODE:enum(boxes|pixelate|blur)=pixelate
//!PARAM: PIXEL_SIZE:integer=24,min=4,max=128
//!PARAM: BLUR_SIGMA:number=10.0,min=0.5,max=50
//!PARAM: MIN_SIZE:integer=60,min=20,max=400
//!PARAM: SCORE:number=30,min=5,max=200

// Demonstrates a pure-Go Tool Plugin: face detection via Pigo (Pico
// cascade), embedded as a binary blob — no CGO, no ONNX runtime, ~3.6
// MB binary including the cascade. Three render modes:
//
//   "boxes"    — outline each face with a red rectangle
//   "pixelate" — mosaic each face region (privacy default)
//   "blur"     — gaussian blur each face region
//
// Detection metadata (counts + boxes) is also emitted as JSON on
// stderr; the Wails console doesn't surface that yet, but `mlcos-run`
// users can pick it up directly.

const img = Engine.loadImage(INPUT);

const out = Engine.tool('facedetect').apply(img, {
    mode:         MODE,
    pixelSize:    PIXEL_SIZE,
    blurSigma:    BLUR_SIGMA,
    minSize:      MIN_SIZE,
    scoreThreshold: SCORE,
});

out.save(OUTPUT);

img.free();
out.free();

// © 2026 Michael Lechner · mlc OpticScript · https://mlcgo.eu · Elastic License 2.0