Trace PNG or JPEG to SVG
Upload a dark logo, signature or line drawing on a light background. The vectorizer follows the outlines and writes black SVG paths that you can scale or edit. Choose a higher threshold to pick up faint pencil lines or a lower one to leave out a gray paper background.
curl -fsS https://aisenseapi.com/services/v1/image_vectorize \
-F "file=@mark.png" \
-F "threshold=65" -o traced.json &&
curl -fsS "$(jq -er .storage_url traced.json)" -o traced.svgTry it in the browser
This form posts your image to the same endpoint and shows the stored result. The image is sent to aisenseapi.com, and the result is kept for 24 hours at a link that anyone with the link can open.
What gets traced
The service places transparent pixels on white and fits the whole image inside 1024 × 1024, preserving its proportions. Smaller images keep their size. Pixels darker than the threshold form the black foreground. The remaining area is transparent. This works best for silhouettes and line art. In a photograph, color and shading collapse into a single foreground shape or a set of outlines.
Trace and download
Send POST /services/v1/image_vectorize as multipart/form-data.
| Field | Required | Value |
|---|---|---|
file | yes | A JPEG or PNG up to 10 MB and 25 megapixels. |
threshold | no | An integer from 1 to 99. The default is 50. |
The command at the top uses curl and jq. Give it a local mark.png, use file=@scan.jpg for a JPEG, or create a sample PNG with the SVG-to-PNG example. The POST saves a JSON receipt to traced.json. The GET downloads the SVG into traced.svg.
Result fields
| Field | Meaning |
|---|---|
storage_id, storage_url | Where the result is. A GET on the URL returns it. |
sha256_hash, bytes | The digest and size of the stored result. |
expire_timestamp, expire_datetime | When the result is removed, 24 hours after it was stored. |
content_type, format, filename | image/svg+xml, svg, and the suggested download name. |
operation, threshold | image_vectorize and the threshold used for the trace. |
width, height | Dimensions of the traced image. |
input_format, input_bytes | Format and size of the uploaded image. |
The receipt identifies the file as image/svg+xml. Storage serves the bytes as application/octet-stream, so use the download button or save the file as result.svg. The link expires after 24 hours. A white image produces a transparent SVG. If a detailed trace returns HTTP 413, simplify or downsize the source and try again.
Errors
A refused request stores nothing and answers with error. The endpoint's own refusals also carry fix, a sentence saying what to send instead.
| Status | When |
|---|---|
400 | The threshold is outside 1 to 99, a field is invalid or the image cannot be decoded. |
405 | The method is not POST. |
413 | The upload, its number of pixels or the result is over a limit. |
415 | The body is not multipart/form-data, or the file is not a JPEG or PNG. |
429 | More than 5000 requests from one IP address per day, or the day's Storage budget is used up. |
503 | The image service is busy, timed out or unavailable. |
Questions
Will the SVG keep my colors?
The SVG uses black paths on transparent space. Use the image converter for a full-color raster result.
How do I keep more of a faint drawing?
Raise the threshold to include lighter pixels. Lower it if shadows or paper texture start to appear.
Related tools
- Image converter, image resizer and image compression, and the HEIC to JPG converter for iPhone photos
- Image metadata viewer and EXIF remover
- PNG or JPEG to SVG for tracing a logo, signature or scan into paths
- Guide: how to convert HEIC, WebP, PNG and JPG, and make images smaller
- Guide: how to see and remove the location hidden in your photos
- Color palette and favicon generator
- Guide: favicon sizes and the files a website needs
- JSON to CSV, CSV to JSON and table matching
- JSON formatter and JSON validator
- File uploader and the Temporary Storage API, where every result is kept for 24 hours