convert_image_to_svg
Convert raster images (PNG, JPG, WEBP) into SVG vector format with adjustable tracing parameters for control over fidelity and complexity.
Instructions
Convert a raster image (PNG, JPG, or WEBP) to SVG vector format.
Accepts either base64-encoded image data or a URL. Returns the SVG content as a string. Adjust tracing parameters to control the fidelity and complexity of the output.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image_base64 | No | Base64-encoded image data (PNG, JPG, or WEBP). Provide this OR image_url, not both. | |
| image_url | No | URL to fetch the image from (PNG, JPG, or WEBP). Provide this OR image_base64, not both. | |
| colormode | No | Color mode: 'color' for full color, 'binary' for black/white line art | color |
| mode | No | Tracing mode: 'spline' (smooth curves), 'polygon' (straight edges), or 'none' (pixel-perfect) | spline |
| filter_speckle | No | Remove speckles of this many pixels or fewer. Higher = cleaner but loses small details. Default 4. | |
| color_precision | No | Number of significant bits for color quantization. Lower = fewer colors, simpler SVG. Default 6. | |
| layer_difference | No | Color difference threshold for merging layers. Higher = fewer layers, simpler SVG. Default 16. | |
| corner_threshold | No | Angle threshold in degrees for detecting corners. Default 60. | |
| length_threshold | No | Minimum path segment length. Default 4.0. | |
| splice_threshold | No | Angle threshold for splicing splines. Default 45. | |
| path_precision | No | Decimal precision for SVG path coordinates. Lower = smaller file size. Default 8. | |
| hierarchical | No | Layer arrangement: 'stacked' (overlapping) or 'cutout' (non-overlapping) | stacked |
| max_iterations | No | Maximum curve fitting iterations. Higher = more accurate but slower. Default 10. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |