image-to-image (line-art extraction) · vision · WASM · ~17 MB
Give this model any photo and it renders an artistic line drawing: clean contour lines that trace the scene's shapes and structure, ink on white paper. Informative Drawings (CVPR 2022) is a generator trained to draw lines that convey geometry and semantics — not a Sobel/Canny edge filter, but a learned artist's rendering of what matters in the picture. It's the kind of line/soft-edge extractor used to condition image generators (ControlNet), and it runs entirely on your device via ONNX Runtime Web; the photo never leaves the tab.
| Model | rocca/informative-drawings-line-art-onnx — ONNX export of carolineec/informative-drawings (MIT) |
|---|---|
| Task | image-to-image (photo → line drawing) — run via raw ONNX Runtime Web (see note below) |
| Runtime | onnxruntime-web 1.21 (transformers.js has no informative-drawings class / no line-art task) |
| Input | input [1, 3, H, W] float32 in 0–1 — the photo, plain RGB (no normalisation), H/W rounded to a multiple of 8 |
| Output | output [1, 1, H, W] float32 in 0–1 — a single-channel drawing (~1 = white paper, low = ink line) |
| Quantization | fp32 ONNX (single file) — runs on the plain WASM execution provider, no WebGPU needed |
| Backend | WebAssembly (single-threaded on GitHub Pages) — a 512-px pass is a few seconds |
| Download | ~17 MB, cached after first load (auto-inits on return) |
| License | MIT (upstream carolineec/informative-drawings) · the ONNX re-export restates no separate license |
| Web APIs | WebAssembly, Web Workers, OffscreenCanvas, ImageBitmap — all Baseline widely available |
Pick a photo (or drop your own), then trace it into a line drawing. Drag the divider to wipe between the photo and the drawing.
The wipe above is the real evidence — slide it to see the drawing appear. “Ink coverage” is the fraction of pixels the model drew as line (below the ink threshold); a busy, textured scene inks more, a clean subject on plain background inks less.
Everything runs on your device — the photo and every line the model draws never leave the tab. Gallery images are rights-cleared samples (see each caption for the source).
What did the model decide was a line? This is the ink overlay: the drawing's lines painted in indigo back onto the dimmed original photo, so you can see exactly which contours it chose to keep. A pixel-gradient edge filter would light up every busy texture; Informative Drawings concentrates on the lines that describe the scene's shape — object outlines, structure, salient creases — and drops the noise.
Indigo = a line the model drew; the faded photo behind it shows what that line was tracing. Notice the lines land on meaningful boundaries — the edge of a building, the silhouette of a subject, the frame of a window — rather than on every patch of contrast, which is what makes it read as a drawing and not an edge map.
A clean line drawing of a photo is useful far beyond art — it's a compact, structure-only representation that both people and models can work with. On-device, it's private and free per image:
Informative Drawings renders a plausible artistic line drawing; it's a stylised interpretation of the scene, not a precise geometric edge measurement.
Pick a photo and trace it into a line drawing — wipe between the photo and the drawing and watch the lines appear.
Turn a photo into a printable colouring page or sketch, then download the line drawing as a PNG.
A live "ink coverage" gauge: compare how densely different scenes line up — portraits vs cityscapes vs textures.
Line-art → depth: trace a photo, then run monocular depth so you see structure two ways — contours and distance.
transformers.js has no informative-drawings class and no line-art task, so we run the ONNX graph directly with ONNX Runtime Web. In goes the photo, out comes a single-channel line map:
import * as ort from "onnxruntime-web";
const session = await ort.InferenceSession.create(modelBytes, { executionProviders: ["wasm"] });
// photo → [1,3,H,W] float32 in [0,1] (plain RGB, no normalisation)
const input = new ort.Tensor("float32", toNCHW(photo, W, H), [1, 3, H, W]);
const { output } = await session.run({ input });
// output is [1,1,H,W] in [0,1]: ~1 = white paper, low = ink → render as a grayscale drawing
const drawing = lineMapToImage(output.data, W, H);
Inference and the whole output composite run in a Web Worker so the UI never blocks, and the ~17 MB model is fetched through Cache Storage, so a returning visit auto-initialises with no re-download.