Skip to content
Edith

Docs

Command reference

Spanwell operations

Enable spanwell, then use ed invoke. Spanwell measures an image you open or a display you capture; it never edits the source.

Measure an image and copy the result

Terminal
ed invoke spanwell spanwell.open --timeout 60 --json '{"path":"/tmp/synthetic.png"}'ed invoke spanwell spanwell.add --json '{"tool":"region","start":[20,20],"end":[100,80]}'ed invoke spanwell spanwell.edges --json '{"tool":"horizontal","start":[60,40],"tolerance":16}'ed invoke spanwell spanwell.settings --json '{"unit":"points","scaleX":2,"scaleY":2}'ed invoke spanwell spanwell.export --json '{"format":"markdown"}' --rawed invoke spanwell spanwell.image.save --timeout 60 --json '{"path":"/tmp/measurements.png","oneX":true}'ed invoke spanwell spanwell.shelf.save --timeout 60 --json '{}'

Points are [x, y] pixels in the upright image, with the origin at the top-left.

Operations

Operation Payload Result
spanwell.read {} The snapshot
spanwell.open path of an image file The snapshot
spanwell.capture displayID from the snapshot's displays The snapshot
spanwell.add tool, start, end, optional square, snap, tolerance The snapshot
spanwell.edges tool, start, optional tolerance (0 to 255) The snapshot
spanwell.gap tool (horizontal or vertical), id, otherID of two regions The snapshot
spanwell.select, spanwell.delete id, or the selection when omitted The snapshot
spanwell.move dx, dy, optional resize, optional id The snapshot
spanwell.update optional id, start and end, label, locked The snapshot
spanwell.settings optional unit (pixels or points), scaleX, scaleY (0.1 to 16) The snapshot
spanwell.selection selection in the normalized form below The snapshot
spanwell.undo, spanwell.redo, spanwell.clear {} The snapshot
spanwell.export format: markdown, css or json The text as a JSON string
spanwell.copy format The text, also copied to the clipboard
spanwell.selection.copy {} The normalized selection, also copied
spanwell.sample {} The selected region's center color as #RRGGBB, also copied
spanwell.color.selection {} Sends the selected region to Color Picker, which copies the color in its own format
spanwell.image.copy, spanwell.image.save, spanwell.shelf.save optional crop, padding (0 to 256), oneX; image.save needs an absolute .png path The snapshot
spanwell.overlay.show, spanwell.overlay.hold, spanwell.overlay.close {} The snapshot
spanwell.session.restore, spanwell.session.forget {} The snapshot
spanwell.dismissIssue {} The snapshot without the capture or shortcut issue

actions.catalog lists capture (measure the display under the pointer), copyMarkdown and copyCSS; actions.perform runs one by actionID.

Results

The snapshot contains document (the image, its measurements, the unit and the selected measurement), imagePath (an upright PNG copy of the source), displays, canUndo, canRedo, overlay, savedSession and an optional issue such as a shortcut that could not be registered.

The normalized selection is imageID, frame (Foundation CGRect coding, values from 0 to 1) and coordinateSpace: upright-normalized-top-left.

Errors

Spanwell runs one change at a time. A second change while one is running fails with Spanwell is still finishing the previous change. Try again in a moment. spanwell.read always answers. spanwell.shelf.save needs Notch Shelf and fails with an install or turn on message when it is missing. spanwell.color.selection needs Color Picker to be running. Display capture needs Screen Recording permission; opening image files does not.