Text overlay — watermark, tech strip, caption
Drops watermark, EXIF-style metadata, timestamp, and a centred caption onto a photograph using the engine's two embedded fonts (Inter sans-serif, JetBrains Mono monospace). No font file to ship — drawText works zero-config.
INPUT
Annotated
JavaScript
// Text overlay — labels, watermark, tech metadata
// demo_text_overlay.js
//!INPUT: INPUT
//!OUTPUT: OUTPUT
//!PARAM: TIMESTAMP:string=2026-05-04 14:30
//!PARAM: BRAND:string=© 2026 OpticScript
// Demonstrates the built-in text engine: two embedded variable fonts
// (Inter for sans-serif, JetBrains Mono for monospace) drive every
// label out of the box — no font files to ship, no fallback fonts
// needed. drawText() places one line at (x, baseline-y) with optional
// anchor (start/middle/end), color, and family.
const img = Engine.loadImage(INPUT);
const W = img.width;
const H = img.height;
// 1) Brand watermark — bottom-right corner, semi-transparent.
img.drawText(BRAND, W - 24, H - 24, {
font: "Inter",
size: 24,
color: new Pixel(1, 1, 1, 0.55),
anchor: "end",
});
// 2) Tech metadata strip — top-left, JetBrains Mono.
img.drawText(`ISO 400 · F2.8 · 1/125s`, 24, 38, {
font: "JetBrains Mono",
size: 18,
color: new Pixel(0.4, 1.0, 0.4, 1),
});
// 3) Timestamp — top-right, smaller, monospace for grid alignment.
img.drawText(TIMESTAMP, W - 24, 38, {
font: "JetBrains Mono",
size: 16,
color: new Pixel(1, 1, 1, 0.85),
anchor: "end",
});
// 4) Centred caption — Inter @ 64 px, soft white.
img.drawText("OPTIC SCRIPT", W / 2, H / 2, {
font: "Inter",
size: 72,
color: new Pixel(1, 1, 1, 0.18),
anchor: "middle",
});
img.save(OUTPUT);
img.free();
// © 2026 Michael Lechner · mlc OpticScript · https://mlcgo.eu · Elastic License 2.0