Skip to content

add_image ​

POST /add_image

口径:本页参数表最后核对于 v23.9(2026-10-27)。v24.0~v24.8 的改动(add_video 的 timeline_start/timeline_end 别名、apply_edl 批内失败计数、resource/search 的 limit 与 count 等价、/agent/route 类型分诊等)以 llms-full.txt 与 GET /agent/capabilities 为准。

接口说明 ​

向草稿添加图片素材,并设置显示区间、位置、缩放、入场动画、出场动画、组合动画和转场。图片的持续时间由 end - start 决定;服务端只保存图片 URL,不下载图片。

start / end 表示图片在时间轴上的秒数。该接口也兼容 target_timerange,例如 {"start": 3, "duration": 2.8},默认按秒解释。

内联转场只认 transition、transition_resource_id、transition_effect_id、transition_md5,不认 transition_name。给已有片段加转场时,优先使用独立的 POST /add_transition。

请求参数 ​

参数必填默认值说明
draft_folder否—草稿输出目录;本地部署时可指定剪映草稿根目录
image_url是—远程图片 URL;服务端只保存 URL,不下载图片
width否1080画布或素材宽度
height否1920画布或素材高度
start否自动接在图片轨道末尾时间轴开始时间,单位秒
end否start + 3时间轴结束时间,单位秒
target_timerange否—兼容写法,按秒传 {"start": 3, "duration": 2.8}
draft_id否—草稿 ID;省略时创建新草稿
transform_y否0Y 轴位置偏移
scale_x否1X 轴缩放比例
scale_y否1Y 轴缩放比例
transform_x否0X 轴位置偏移
track_name否'image_main'目标轨道名称
relative_index否0轨道叠加顺序
position_preset否—位置预设,覆盖 transform_x/y;可选 center、top-center、bottom-center、top-left、top-right、bottom-left、bottom-right
size_preset否—尺寸预设,覆盖 scale_x/y;可选 small、medium、large、full-width
motion_preset否—运镜预设,自动生成关键帧;可选 zoom_in_slowly、zoom_out_slowly、pan_left_to_right、pan_right_to_left、ken_burns、shake
insert_position否appendstart 从 0 秒开始,append 追加到轨道末尾
sync_with_segment否—传入已有 segment_id,新片段起点与其对齐,优先级高于 insert_position
animation否—组合动画名称
animation_duration否0.5组合动画时长,单位秒
intro_animation否—入场动画名称或资源 ID
intro_animation_duration否0.5入场动画时长,单位秒
intro_animation_resource_id否—入场动画 resource_id
intro_animation_effect_id否—入场动画 effect_id
intro_animation_md5否—入场动画 md5
outro_animation否—出场动画名称或资源 ID
outro_animation_duration否0.5出场动画时长,单位秒
outro_animation_resource_id否—出场动画 resource_id
outro_animation_effect_id否—出场动画 effect_id
outro_animation_md5否—出场动画 md5
combo_animation否—组合动画名称或资源 ID
combo_animation_duration否0.5组合动画时长,单位秒
combo_animation_resource_id否—组合动画 resource_id
combo_animation_effect_id否—组合动画 effect_id
combo_animation_md5否—组合动画 md5
transition否—转场名称或资源 ID;先查询 resource_search。内联调用优先传 ID
transition_duration否0.5转场时长,单位秒
transition_resource_id否—转场 resource_id
transition_effect_id否—转场 effect_id
transition_md5否—转场 md5
mask_type否—蒙版名称或资源 ID;先查询 resource_search
mask_resource_id否—蒙版 resource_id
mask_effect_id否—蒙版 effect_id
mask_md5否—蒙版 md5
mask_center_x否0.0蒙版中心 X 坐标
mask_center_y否0.0蒙版中心 Y 坐标
mask_size否0.5蒙版大小
mask_rotation否0.0蒙版旋转角度
mask_feather否0.0蒙版羽化程度
mask_invert否False是否反转蒙版
mask_rect_width否—矩形蒙版宽度
mask_round_corner否—矩形蒙版圆角,范围 0-100
background_blur否—背景模糊级别,可选 1-4

调用示例 ​

bash
curl -X POST https://your-domain.example/api/add_image \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $VECTCUT_API_KEY" \
  -d '{
    "draft_id": "dfd_cat_demo_001",
    "image_url": "https://example.com/cover.png",
    "start": 0,
    "end": 3,
    "intro_animation": "缩小",
    "transition_resource_id": "7049979667406656014",
    "mask_type": "圆形",
    "mask_center_x": 0.5,
    "mask_center_y": 0.5,
    "mask_size": 0.5
  }'

等价的时间轴写法:

json
{
  "draft_id": "dfd_cat_demo_001",
  "image_url": "https://example.com/cover.png",
  "target_timerange": {
    "start": 3,
    "duration": 2.8
  }
}

这表示图片从第 3 秒开始显示 2.8 秒。不要传 target_timerange_unit: "us",除非确实在处理旧版微秒数据。

返回格式 ​

json
{
  "success": true,
  "output": {
    "draft_id": "dfd_cat_demo_001",
    "draft_url": "https://your-domain.example/api/draft/downloader?draft_id=dfd_cat_demo_001"
  },
  "error": ""
}

个人自建服务