Skip to content

Resume editing

Store the original once and the edit log as JSON. Reopen any time, on any device, at any index, and keep editing. Nothing is re-encoded, so there is no generation loss.

ts
const saved = editor.getEditLog();            // { log, index }
localStorage.setItem(key, JSON.stringify(saved));

// later, elsewhere
editor.defaultEditLog = JSON.parse(localStorage.getItem(key));
editor.src = originalFile;

The session verifies that the log belongs to the image: the source hash must match (SOURCE_MISMATCH otherwise), and the dimensions must agree.

Embedded logs

download({ embedEditLog: true }) writes the canonical { log, index } into the exported file: a PNG iTXt chunk, a JPEG APP1 XMP packet or a WebP XMP chunk. readEmbeddedState(bytes, registry) reads it back without decoding pixels. Embedding is off by default because the log may contain text you do not want to ship.