IMGPOW

Recipes: edit images with JSON

A recipe is a list of editing steps. ImgPow applies it in your browser, like everything else: no server sees the image or the recipe.

Example

{
  "steps": [
    {
      "op": "crop",
      "aspect": "1:1"
    },
    {
      "op": "resize",
      "width": 1080
    },
    {
      "op": "adjust",
      "style": "warm",
      "contrast": 15
    },
    {
      "op": "text",
      "text": "SALE -30%",
      "x": "50%",
      "y": "88%",
      "size": 96,
      "color": "#ffffff",
      "outline": 6
    },
    {
      "op": "export",
      "format": "webp",
      "quality": 85
    }
  ]
}

ImgPow recipe: {"steps":[{op,...}]}. Coordinates in canvas pixels or "50%" strings. Layers by index (0 = bottom) or "top" (default for layer ops: top layer; for adjust/removeBackground: top image layer).

Three ways to use one

  1. Paste it: open an image, click { } in the top bar, paste the recipe and click Apply. The same window shows the current state and copies a shareable link.
  2. As a link: /#recipe=<base64url of the JSON>. The recipe runs as soon as an image is opened (or right away if it starts with a new step). The data travels in the URL fragment, which browsers never send to servers.
  3. From code or an AI agent: in the page, await window.imgpow.apply(recipe) returns {ok, warnings, state} or {ok:false, error:"step N: …"}; window.imgpow.state() describes the document (size, layers) and window.imgpow.export({format, quality, scale}) returns a Blob. Browsers with WebMCP (navigator.modelContext) also get the tools imgpow_get_state, imgpow_apply_recipe and imgpow_export.

Steps

opFields
new{op:"new", width, height, background?: "#rrggbb"|null}
crop{op:"crop", x?, y?, width?, height?} or {op:"crop", aspect:"1:1"} (centered)
resize{op:"resize", width?, height?} (keeps proportions if one is missing; scales everything)
canvas{op:"canvas", width, height} (adds or trims border, centered, no scaling)
rotate{op:"rotate", direction: "right"|"left"} (90°)
flip{op:"flip", axis: "horizontal"|"vertical"}
background{op:"background", color: "#rrggbb"|null}
adjust{op:"adjust", layer?, style?: original|bw|sepia|warm|cool|vivid|retro|drama|faded|cinema|film|crisp, brightness, contrast, saturation, hue, temperature, sepia, blacks, whites, midtones, fade, sharpen, grain, blur, vignette, curve?: [[x,y],...]} (values like the sliders, mostly -100..100)
text{op:"text", text, x?, y?, size?, color?, font?, bold?, italic?, outline?, outlineColor?, shadow?, label?: "#rrggbb", align?}
shape{op:"shape", shape: rect|ellipse|line|arrow, from:[x,y], to:[x,y], stroke?, fill?, width?, radius?}
layer{op:"layer", layer?, x?, y?, scale?, rotation?, opacity?, blend?, visible?, name?, delete?: true}
removeBackground{op:"removeBackground", layer?, tolerance?: 1..100, softness?: 0..4} (plain backgrounds)
export{op:"export", format: png|jpeg|webp, quality?: 1..100, scale?: 0.25..2}

Tip: each recipe is one undo step, so Ctrl+Z reverts it entirely. Unknown fields produce warnings, not errors.