image

image embeds a static image. The source path resolves relative to the build entry file and the file is copied verbatim into _wdoc/ at build time, so the output site is self-contained. Because it's referenced by a relative _wdoc/ URL, it only resolves when the site is served — not when the page is opened directly from disk (same as icons and tilemaps).

PropertyTypeRequiredDescription
sourceutf8yesImage source (the inline label): a doc-relative path, a URL, or a data: URI.
altutf8noAlt text for the <img> (page form).
widthf64noDisplay width; the natural size is used when omitted.
heightf64noDisplay height; the natural size is used when omitted.
ididentifiernoOptional explicit HTML id.
classlist<utf8>noOptional style classes.
xf64noPlacement x when used inside a diagram (ignored on a page).
yf64noPlacement y when used inside a diagram (ignored on a page).
scalef64noExtra size multiplier (diagram form).
anchor_leftf64noDiagram anchor insets (left/right/top/bottom), like any shape.
connect_pointslist<AnchorSide>noDiagram edge-attach sides, like any shape.

§ 1On a page

An image block directly under a page renders as a standalone <img>. The source is the inline label; set width / height to size it, alt for accessibility, and a class for styling (live below — a Kenney CC0 spritesheet, scaled down):

Preview

A platformer tile sheet
A platformer tile sheet

Example

image "../../assets/kenney-platformer.png" {
  alt = "A platformer tile sheet"
  width = 240.0
}

§ 2Inside a diagram

image is also a placeable SvgBlock, so it can sit in a diagram / container alongside rect / circle, positioned by x / y (or anchors).

Preview

Example

diagram {
  width = 280
  height = 140
  image "../../assets/kenney-platformer.png" {
    x = 20.0
    y = 20.0
    width = 100.0
    height = 100.0
  }
  rect {
    x = 150.0
    y = 45.0
    width = 100.0
    height = 50.0
    fill = "#a3be8c"
  }
}