{
  "slug": "image",
  "title": "image resize & convert",
  "description": "Resize, compress, and convert images — png, jpeg, webp — entirely in the browser. Handles batches.",
  "category": "media",
  "status": "live",
  "url": "https://aaronchartier.com/tools/image",
  "keywords": [
    "image",
    "resize",
    "compress",
    "convert",
    "png",
    "jpeg",
    "webp",
    "quality",
    "scale",
    "batch",
    "photo"
  ],
  "samples": [
    {
      "label": "convert to webp",
      "query": "mode=convert&format=webp"
    },
    {
      "label": "resize to 1600px wide",
      "query": "mode=resize&width=1600"
    },
    {
      "label": "compress at 70%",
      "query": "mode=compress&quality=0.7"
    }
  ],
  "privacy": "all computation is client-side; no input is transmitted",
  "pageApi": "window.__tools[\"image\"] — run(input), describe(); output in #tool-output",
  "params": {
    "image": "ArrayBuffer | Uint8Array | Blob | base64/data-URL string — the source image (anything the browser decodes; output is png/jpeg/webp)",
    "op": "'resize' | 'compress' | 'convert' (default convert; `#mode=` pre-fills the UI)",
    "format": "'png' | 'jpeg' | 'webp' — output format (required for convert; resize defaults to the source format, compress to webp; `#format=` pre-fills)",
    "quality": "lossy quality for jpeg/webp, 0..1 or 1..100 (default 0.82; ignored for png; `#quality=` pre-fills)",
    "width": "resize target width, px — aspect kept when height is omitted (`#width=` pre-fills)",
    "height": "resize target height, px — aspect kept when width is omitted (`#height=` pre-fills)",
    "scale": "resize scale factor, e.g. 0.5 — wins over width/height"
  },
  "returns": "{ bytes: Uint8Array, width, height, type: mime string, byteLength } — the re-encoded image; the longest side is capped at 8192px",
  "async": true,
  "example": {
    "run": {
      "image": "<base64 image>",
      "op": "convert",
      "format": "webp",
      "quality": 0.8
    },
    "note": "page-only — run() lives on /tools/image via window.__tools.image (image bytes can't cross WebMCP); files can't be pre-filled from a URL"
  }
}