跳转到内容

Image2svg

集成

模型 id image2svg
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/image2svg?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

此请求: $0.005 5 API 积分 在此页面运行

获取 API 密钥
Utility 图像编辑 #utility#editing

将栅格图像矢量化为 SVG,支持彩色或二值模式以及样条或多边形路径

Utility · 图像

你的第一个结果将在此显示

在下方构建请求,并使用你的 API 密钥运行。输出会复制到我们的存储中,可永久保存或免费保存 7 天。

构建请求

控件根据模型架构生成。更改控件时,代码和价格会同步更新。

•必填 image_url
拖放文件,或

用于转换为 SVG 的源图像。

高级 colormode · hierarchical · mode · filter_speckle · color_precision · layer_difference · corner_threshold · length_threshold · max_iterations · splice_threshold · path_precision
colormode 默认 color

输出模式选择:color 表示彩色输出,binary 表示黑白输出。

hierarchical 默认 stacked

层级模式选择:stacked 或 cutout。

mode 默认 spline

路径模式:spline 用于曲线,polygon 用于直线。

默认 4

过滤噪点和小斑点。

默认 6

用于颜色量化的级别。

默认 16

层级模式下各层之间差异的阈值。

默认 60

用于检测角点的角度阈值,单位为度。

默认 4

应用于曲线或线条长度的阈值。

默认 10

优化迭代次数上限。

默认 45

拼接路径时使用的阈值。

默认 3

路径坐标的小数位精度。

POST /run/image2svg?wait=20 报价 → $0.005
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/image2svg?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

运行此请求

你的密钥会保留在此浏览器中:仅发送到 Doitong API;只有勾选“记住”后才会保存到 localStorage。 获取 API 密钥

关于 Image2svg

将栅格图像转换为 SVG 文件。`colormode` 用于切换彩色和二值输出,`mode` 用于选择样条曲线或多边形,`hierarchical` 用于选择叠加或镂空图层。可通过 `filter_speckle`(0 到 20)、`color_precision`(1 到 10)和 `path_precision`(1 到 10)等设置调整细节。

参数

发送规范名称或原生名称之一,不要同时发送两者。 规范名称

名称类型 默认值允许值 描述
image_url必填 image
类型url · image
用于转换为 SVG 的源图像。
colormode可选
类型enum
默认值color
colorbinary
输出模式选择:color 表示彩色输出,binary 表示黑白输出。
hierarchical可选
类型enum
默认值stacked
stackedcutout
层级模式选择:stacked 或 cutout。
mode可选
类型enum
默认值spline
splinepolygon
路径模式:spline 用于曲线,polygon 用于直线。
filter_speckle可选
类型integer
默认值4
0 – 20
过滤噪点和小斑点。
color_precision可选
类型integer
默认值6
1 – 10
用于颜色量化的级别。
layer_difference可选
类型integer
默认值16
1 – 32
层级模式下各层之间差异的阈值。
corner_threshold可选
类型integer
默认值60
0 – 180
用于检测角点的角度阈值,单位为度。
length_threshold可选
类型number
默认值4
0 – 10
应用于曲线或线条长度的阈值。
max_iterations可选
类型integer
默认值10
1 – 20
优化迭代次数上限。
splice_threshold可选
类型integer
默认值45
0 – 90
拼接路径时使用的阈值。
path_precision可选
类型integer
默认值3
1 – 10
路径坐标的小数位精度。
必填 规范名称,也可接受

文件参数接受公开的 https:// URL、最大 10 MB 的 data: URI,或上传文件的 file_url。 文件

输出

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "image2svg",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 5,
    "usd": "0.005",
    "charged": 5,
    "refunded": 0
  },
  "input": {
    "image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  },
  "output": {
    "images": [
      {
        "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
        "content_type": "image/jpeg",
        "file_name": "0-output.jpeg",
        "file_size": 1843200
      }
    ]
  },
  "outputs": [
    {
      "type": "image",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_size": 1843200,
      "width": 1024,
      "height": 768,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
你的文件,由你选择每个 outputs[].url 都是存储中的副本:可永久保存(按 GB-月付费),也可免费保存 7 天,由账户设置或 ?storage= 决定。
每个模型的结构相同图像、视频和音频均包含 type、url、content_type、width、height 和 duration。output 是模型自身的结果对象。
输出字段
images
array of object {url, content_type, file_name, file_size}转换生成的 SVG 文件。

对于 AI 代理:此页面的 Markdown 版本位于 https://doitong.com/zh/developers/models/image2svg.md. 所有模型和指南: https://doitong.com/developers/llms.txt