vectorize · diff
git:20261016.f908cbd to git:20261016.8dbae0f
15 added, 30 removed. Audit A to A.
---
name: vectorize
- description: "Convert a raster image (PNG, JPG, WebP) to a clean, scalable SVG vector using AI tracing. Triggers on: vectorize, convert to svg, trace image, image to svg, make svg, png to svg, jpg to svg."
+ description: "Convert a raster image (PNG, JPG, WebP) to a clean, scalable SVG vector with svg.new. Triggers on: vectorize, convert to svg, trace image, image to svg, make svg, png to svg, jpg to svg."
---
# Vectorize Image to SVG
- Convert a raster image to a clean SVG vector using svg.new's AI tracing engine.
+ Convert a raster image to a clean SVG with svg.new's tracing engine.
- ## Prerequisites
+ ## Before you start
- Use the svg.new MCP tools if they are available in this session (`mcp__svgnew__*`, or `mcp__plugin_svg-vectorizer_svg-new__*` when this plugin provides them); they need no API key. Otherwise the `SVG_NEW_API_KEY` environment variable must be set. If neither is available, tell the user:
- > Connect svg.new with `claude mcp add --transport http --scope user svgnew https://svg.new/api/mcp` and `/mcp` → Authenticate, or generate an API key at https://svg.new/account and set `export SVG_NEW_API_KEY="svk_..."`.
+ Use the svg.new MCP tools from this plugin (named `mcp__plugin_svg-vectorizer_svg-new__*`, or `mcp__svgnew__*` if the user connected the server directly). They sign in with the user's svg.new account, so no API key is involved. If the tools are missing or say sign-in is needed, ask the user to run `/mcp`, pick the svg.new server and choose **Authenticate**.
- Do not fall back to a local tracer (vtracer, potrace) unless the user asks for one.
+ Don't fall back to a local tracer (vtracer, potrace) unless the user asks for one.
- Files over ~100 KB are too big to pass inline to the MCP `vectorize` tool. Call `create_upload`, run the curl PUT command it returns with the file's path (up to 20 MB, straight to svg.new's storage), then call `vectorize` with the `upload_id`; the result comes back as a one-hour download link (`curl -sL -o output.svg "<link>"`). If the image is at a public HTTPS URL, `image_url` also works (up to 20 MB). Otherwise use the curl route below, which builds the base64 in the shell.
## Steps
- 1. Identify the image file from the user's request or `$ARGUMENTS`
- 2. Read the file and determine its MIME type from the extension:
- - `.png` → `image/png`
- - `.jpg` / `.jpeg` → `image/jpeg`
- - `.webp` → `image/webp`
- 3. Base64-encode the file contents
- 4. Construct the data URL: `data:<mime>;base64,<encoded>`
- 5. Call the API:
-
- ```bash
- curl -s -X POST "${SVG_NEW_API_URL:-https://svg.new}/api/agent/vectorize" \
- -H "Authorization: Bearer $SVG_NEW_API_KEY" \
- -H "Content-Type: application/json" \
- -d "{\"image\": \"$DATA_URL\"}"
- ```
-
- 6. Extract the `svg` field from the JSON response
- 7. Write it to a `.svg` file (same name as input, different extension)
- 8. Report the output path and credits remaining from `metadata.credits_remaining`
+ 1. Find the image from the user's request or `$ARGUMENTS`. svg.new takes PNG, JPEG and WebP.
+ 2. Send it to the `vectorize` tool in one of three ways:
+ - **Public HTTPS link:** pass it as `image_url` (up to 20 MB).
+ - **Small local file (up to about 100 KB):** read it, base64-encode it and pass `image` as `data:<mime>;base64,<data>` (`image/png`, `image/jpeg` or `image/webp`).
+ - **Larger local file (up to 20 MB):** call `create_upload`. It returns an `upload_id` and a `put_url`. Upload the file there with an HTTP PUT, for example `curl -sS -X PUT -H "Content-Type: image/png" --upload-file <path> "<put_url>"`, then call `vectorize` with the `upload_id`.
+ 3. Save the result next to the input with an `.svg` extension. Write the SVG text if it came back inline; if it came back as a download link (valid for one hour), save it with `curl -sL -o <name>.svg "<link>"`.
+ 4. Report the output path, size, path count and the credits remaining.
## Notes
- - Maximum image size: 20MB
- - Costs 1 credit per vectorization
- - The API returns the full SVG as a string in the `svg` field
- - The `id` field can be used to view the result at `https://svg.new/edit/{id}`
+ - Each vectorization costs 1 credit. Free accounts get 3 a day.
+ - Pass `output: "url"` to always get a download link instead of inline SVG.
+ - The result's ID opens in the editor at `https://svg.new/edit/<id>`.