Wardian docs

Image lab

Try it

The app runs here in your browser. Nothing you type leaves it. Open it on its own.

Download image-lab.wardian Import it in Wardian: Settings → Import.

For anyone who wants to touch up or play with a picture without uploading it anywhere: open a photo, try filters (blur, sharpen, edges, tone, posterize, threshold) with a before-and-after divider and a live RGB histogram, keep the changes you like, undo the rest, and save a PNG. WebAssembly does every pixel loop; the picture never leaves this computer.

What you put in#

InputTypeUnitAllowedDefaultRequired
Picturea filean image the browser can read (PNG, JPEG, WebP, GIF, BMP, AVIF…); over 12 megapixels is scaled downa sample picture, labelledrequired to edit (the sample is open at first)
Toolone of Brightness and contrast, Gaussian blur, Box blur, Sharpen, Posterize, ThresholdBrightness and contrastrequired
Brightnesswhole number−100 to 1000
Contrastwhole number−100 to 1000
Spreaddecimal, steps of 0.5pixels0.5 to 403
Radiuswhole numberpixels1 to 604
Amountdecimal, steps of 0.1times0.1 to 41
Edge widthdecimal, steps of 0.5pixels0.5 to 81.5
Levels per channelwhole numberlevels2 to 164
Cut-offwhole numberlevel0 to 255128
Compare before and afteron or offon
Divider positionwhole number% of the width0 to 10050

The sliders allow only their range and step, so a value cannot be out of range.

What it shows#

How it behaves#

Layout#

Two columns that Arrange may swap or join; one column under 760px. Reading order and tab order:

  1. Open a picture (side): the drop area with Choose a file… (input type="file" with accept="image/*") and its hint, where file errors show; Use a sample picture.
  2. Quick filters (side): Grayscale, Sepia, Invert, Edge detect.
  3. Adjust (side): Tool (select, size-md), the tool's sliders, each with its value and unit beside it, the note, then Apply (solid, the main action) and Discard.
  4. History (side): the list, Undo, Reset, Save image.
  5. Picture (main): the source badge, the picture, then Compare before and after and the divider slider.
  6. Histogram (main): the chart and its legend (red, green, blue, named in text as well).

Files#

FileWhat it is
index.htmlThe page: six panels.
app.jsThe parsers (the file, each slider), opening, preview and undo, the histogram, the divider.
src/lib.rsThe filters, each working in place on one RGBA buffer in WebAssembly memory, and the histogram. Unit tests at the end.
app.wasmBuilt from src/lib.rs by ./build.sh.
ui/The Wardian component library.

How data moves: the page draws the picture on a canvas, copies its RGBA bytes once into a buffer in the module's memory, calls a filter on it in place, and draws the same bytes back. JavaScript keeps the original, the current picture and the undo steps (at most 200 MB of them).

Change it: edit src/lib.rs and app.js, run cargo test, run ./build.sh, then wardian check ..

This page is apps/image-lab/README.md in the repository. Something wrong or missing? Change that file.