Tool plugin demo — wraps the input image in a coloured frame

Demonstrates a single-input Tool Plugin. Uses the 'frame' tool to add a customizable colored rectangular frame around an image. Shows how external tools integrate with the engine.

INPUT
INPUT — Tool plugin demo — wraps the input image in a coloured frame
OUTPUT
OUTPUT — Tool plugin demo — wraps the input image in a coloured frame
JavaScript
// Tool plugin demo — wraps the input image in a coloured frame
// tool_frame.js
//!INPUT: INPUT
//!OUTPUT: OUTPUT
//!PARAM: WIDTH:number=24,min=1,max=4096
//!PARAM: COLOR:string=#ff8800

// Demonstrates a single-IO Tool Plugin. The 'frame' tool is a tiny
// pure-Go binary that ships with the Playground installer; it adds
// a coloured rectangular frame around the input image.
//
// Try changing WIDTH and COLOR via the parameter sliders on the left,
// or open the Tools tab (⚙ → Tools) to see what the tool declares.

const img = Engine.loadImage(INPUT);

const framed = Engine.tool('frame').apply(img, {
    width: WIDTH,
    color: COLOR,
});

framed.save(OUTPUT);

img.free();
framed.free();

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