← All models

image-to-image (line-art extraction) · vision · WASM · ~17 MB

Informative Drawings — turn a photo into a line drawing

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.

At a glance

Modelrocca/informative-drawings-line-art-onnx — ONNX export of carolineec/informative-drawings (MIT)
Taskimage-to-image (photo → line drawing) — run via raw ONNX Runtime Web (see note below)
Runtimeonnxruntime-web 1.21 (transformers.js has no informative-drawings class / no line-art task)
Inputinput [1, 3, H, W] float32 in 0–1 — the photo, plain RGB (no normalisation), H/W rounded to a multiple of 8
Outputoutput [1, 1, H, W] float32 in 0–1 — a single-channel drawing (~1 = white paper, low = ink line)
Quantizationfp32 ONNX (single file) — runs on the plain WASM execution provider, no WebGPU needed
BackendWebAssembly (single-threaded on GitHub Pages) — a 512-px pass is a few seconds
Download~17 MB, cached after first load (auto-inits on return)
LicenseMIT (upstream carolineec/informative-drawings) · the ONNX re-export restates no separate license
Web APIsWebAssembly, Web Workers, OffscreenCanvas, ImageBitmap — all Baseline widely available

Run it

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.

◀ photoline drawing ▶
Drop / choose your own photo (portraits, buildings and objects trace well)

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).

See inside

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.

Trace a photo to see which lines the model kept.

Why it matters

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.

Use cases

Basics

Pick a photo and trace it into a line drawing — wipe between the photo and the drawing and watch the lines appear.

Practical

Turn a photo into a printable colouring page or sketch, then download the line drawing as a PNG.

Wild

A live "ink coverage" gauge: compare how densely different scenes line up — portraits vs cityscapes vs textures.

Multi-model

Line-art → depth: trace a photo, then run monocular depth so you see structure two ways — contours and distance.

How the API works

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.

References