nika:image_fx is the deterministic sibling of
nika:image_generate: a pure pixel transform —
no provider, no network, no clock. Style a PNG through an ordered pipeline of
effects and get an artifact that is byte-identical for identical
(input, args) on the same pinned engine — not a promise across
engine versions.
That determinism is the point, not a detail. The artifact’s sha256 joins the
run’s hash-chained trace, re-rendering the recipe is the tamper check, and the
full recipe (contract tag image_fx/v1 · input sha256 · seed · ops) travels
inside the PNG as a nika tEXt chunk — no timestamp, ever. Your workflow
draws its own receipts.
The 30-second pipeline
skipped_existing: true and the artifact
hash never moves. Mutate one byte of the PNG and a re-render no longer matches
— that mismatch is the tamper detection.
The op vocabulary (closed · v1)
ops: is an ordered list of single-key maps — a linear pipeline by design.
Branching and fan-out belong to the workflow (with:/after: edges ·
for_each), never inside the builtin.
Palettes: presets
bw · gray4 · gameboy · cga · okabe_ito, or an inline list
of 2–256 colors. Unknown op parameters are rejected loudly
(NIKA-BUILTIN-IMAGE_FX-001) — a typo’d knob never silently lies about the
style.
Why deterministic styling matters
Every incumbent styling path is nondeterministic by default — image tools timestamp their outputs, and generative models can’t reproduce bytes across hardware at all. That makes styled assets un-verifiable: you can sign them, but you can’t re-derive them.image_fx inverts that: integer/fixed-point pixel math, a seeded noise
stream, zero wall-clock. So the artifact can be:
- chained — its sha256 lands in the trace (
nika trace verifycovers it); - re-rendered — the same input + the recipe reproduces the exact bytes;
- carried — the recipe rides the artifact itself, so any holder of the input can verify the styling.
for_each and every one of them is a receipt.
fragment · paste into the file above
Output contract
ascii with
emit: text|ansi) land as .txt/.ans, report width/height 0, and are
sha256’d like any other artifact.
Errors are typed NIKA-BUILTIN-IMAGE_FX-001..006 — invalid args · input read
· unsupported format · decode · pixel budget · save — plus the boundary
NIKA-SEC-004 when a path resolves outside permits.fs. An input over 16384
pixels on a side is the pixel budget (-005), and a PNG whose IHDR is not
its first chunk, or that carries a second one, is refused as corrupt (-004):
the size the budget judged from the header is always the size decoded.
Compose several images into one
nika:image_compose is image_fx’s sibling for layout: it lays 1 to 64 PNG
files out as one image, a contact sheet (grid), a side-by-side (row) or a
stack (column). Like image_fx it is pure pixel work, with no provider, no
network and no clock, so identical input bytes and args give identical PNG
bytes, and the image_compose/v1 recipe (each input’s sha256 and size, the
resolved layout) rides the artifact. A contact sheet no longer needs an
image program run through exec:.
Every limit is judged from the PNG headers before any decompression: each
input’s side, the summed input pixels, each scaled cell and the canvas
(
NIKA-BUILTIN-IMAGE_COMPOSE-005). An input count outside 1 to 64 is an
argument error (-001); the codes follow image_fx’s ladder, and
nika explain teaches each one. Inputs are PNG only, as for image_fx. The
output carries path, sha256, width and height (and each input’s
digest), never the bytes, and identical bytes already at out: are an
idempotent skip (skipped_existing). The full contract is
nika:image_compose.