Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗
Wan — Animar uma imagem
Enviar tarefa de animação
Anime a imagem de um personagem transferindo ações e expressões de um vídeo de referência. Use-o para replicar danças, movimentos corporais e expressões faciais — uma alternativa de baixo custo à captura de movimento.
Modos de serviço
wan2.2-animate-move oferece dois modos de serviço:
| Modo | Valor | Descrição |
|---|---|---|
| Padrão | wan-std |
Mais rápido e mais barato. Bom para visualizações rápidas e animações básicas. |
| Profissional | wan-pro |
Mais suave e de maior qualidade, mas mais lento e mais caro. |
Requisitos de entrada
Imagem do personagem (image_url):
- Uma única pessoa voltada para a frente e com o rosto desobstruído
- A pessoa deve ocupar uma porção moderada do quadro
- Formato: JPG, JPEG, PNG, BMP ou WEBP
- Dimensões: 200–4096 px (largura e altura), proporção de 1:3 a 3:1
- Tamanho do arquivo: até 5 MB
Vídeo de referência (video_url):
- Uma única pessoa voltada para a frente e com o rosto desobstruído
- Resolução e taxa de quadros mais altas produzem melhores resultados
- Formato: MP4, AVI ou MOV
- Duração: 2–30 segundos
- Dimensões: 200–2048 px (largura e altura), proporção de 1:3 a 3:1
- Tamanho do arquivo: até 200 MB
OpenAPI
openapi: 3.1.0
info:
title: Wan Image-to-Animation API
description: Animate a character image by transferring actions and expressions from a reference video using the wan2.2-animate-move model.
version: 1.0.0
servers:
- url: https://maas.qwencloudapi.com/api/v1
description: Singapore
security:
- BearerAuth: []
paths:
/services/aigc/image2video/video-synthesis:
post:
operationId: createImageToAnimationTask
summary: Create image-to-animation task
description: Create an image-to-animation task.
parameters:
- name: X-DashScope-Async
in: header
required: true
description: Must be set to `enable`. HTTP requests support only asynchronous processing. Omitting this header returns a "current user api does not support synchronous calls" error.
schema:
type: string
enum:
- enable
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ImageToAnimationRequest"
responses:
"200":
description: Task submitted successfully
content:
application/json:
schema:
$ref: "#/components/schemas/AsyncTaskSubmitResponse"
"400":
description: Invalid request parameters
content:
application/json:
schema:
$ref: "#/components/schemas/DashScopeErrorResponse"
x-codeSamples:
- lang: curl
label: cURL - Image to animation
source: |-
curl --location 'https://maas.qwencloudapi.com/api/v1/services/aigc/image2video/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.2-animate-move",
"input": {
"image_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/adsyrp/move_input_image.jpeg",
"video_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/kaakcn/move_input_video.mp4",
"watermark": true
},
"parameters": {
"mode": "wan-std"
}
}'
- lang: python
label: Python - Synchronous call
source: |-
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_sync_call():
print('Please wait...')
rsp = VideoSynthesis.call(
api_key=api_key,
model='wan2.2-animate-move',
image_url='https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/adsyrp/move_input_image.jpeg',
video_url='https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/kaakcn/move_input_video.mp4',
watermark=True,
mode='wan-std')
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print(rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
sample_sync_call()
- lang: python
label: Python - Asynchronous call
source: |-
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_async_call():
rsp = VideoSynthesis.async_call(
api_key=api_key,
model='wan2.2-animate-move',
image_url='https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/adsyrp/move_input_image.jpeg',
video_url='https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/kaakcn/move_input_video.mp4',
watermark=True,
mode='wan-std')
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print("task_id: %s" % rsp.output.task_id)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
rsp = VideoSynthesis.wait(task=rsp, api_key=api_key)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print(rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
sample_async_call()
- lang: java
label: Java - Synchronous call
source: |-
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;
import java.util.*;
public class WanImageToAnimation {
static {
Constants.baseHttpApiUrl = "https://maas.qwencloudapi.com/api/v1";
}
public static void main(String[] args) {
try {
VideoSynthesis vs = new VideoSynthesis();
Map<String, Object> parameters = new HashMap<>();
parameters.put("mode", "wan-std");
VideoSynthesisParam param = VideoSynthesisParam.builder()
.apiKey(System.getenv("DASHSCOPE_API_KEY"))
.model("wan2.2-animate-move")
.parameters(parameters)
.imageUrl("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/adsyrp/move_input_image.jpeg")
.videoUrl("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/kaakcn/move_input_video.mp4")
.watermark(true)
.build();
System.out.println("Please wait...");
VideoSynthesisResult result = vs.call(param);
System.out.println(JsonUtils.toJson(result));
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
}
}
- lang: java
label: Java - Asynchronous call
source: |-
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;
import java.util.*;
public class WanImageToAnimation {
static {
Constants.baseHttpApiUrl = "https://maas.qwencloudapi.com/api/v1";
}
public static void main(String[] args) {
try {
String apiKey = System.getenv("DASHSCOPE_API_KEY");
VideoSynthesis vs = new VideoSynthesis();
Map<String, Object> parameters = new HashMap<>();
parameters.put("mode", "wan-std");
VideoSynthesisParam param = VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.2-animate-move")
.parameters(parameters)
.imageUrl("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/adsyrp/move_input_image.jpeg")
.videoUrl("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/kaakcn/move_input_video.mp4")
.watermark(true)
.build();
VideoSynthesisResult task = vs.asyncCall(param);
System.out.println(JsonUtils.toJson(task));
System.out.println("Please wait...");
VideoSynthesisResult result = vs.wait(task, apiKey);
System.out.println(JsonUtils.toJson(result));
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
}
}
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
description: DashScope API Key. Create one in the [QwenCloud console](https://home.qwencloud.com/api-keys).
schemas:
ImageToAnimationRequest:
type: object
required:
- model
- input
- parameters
properties:
model:
type: string
description: Model name. Must be `wan2.2-animate-move`.
enum:
- wan2.2-animate-move
example: wan2.2-animate-move
input:
type: object
required:
- image_url
- video_url
description: Input data including the character image and reference video.
properties:
image_url:
type: string
description: |-
A publicly accessible URL of the input character image.
**Image constraints:**
- Format: JPG, JPEG, PNG, BMP, or WEBP.
- Dimensions: Width and height must both be in the range of [200, 4096] pixels. The aspect ratio must be between 1:3 and 3:1.
- File size: Up to 5 MB.
- Content: The image must show a single front-facing person with an unobstructed face, occupying a moderate portion of the frame.
URLs containing non-ASCII characters (such as Chinese characters) must be URL-encoded.
example: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/adsyrp/move_input_image.jpeg
video_url:
type: string
description: |-
A publicly accessible URL of the reference video. The model transfers actions and expressions from this video to the character image.
**Video constraints:**
- Format: MP4, AVI, or MOV.
- Duration: 2 to 30 seconds.
- Dimensions: Width and height must both be in the range of [200, 2048] pixels. The aspect ratio must be between 1:3 and 3:1.
- File size: Up to 200 MB.
- Content: The video must show a single front-facing person with an unobstructed face, occupying a moderate portion of the frame.
For better results, use a reference video with higher resolution and frame rate. URLs containing non-ASCII characters must be URL-encoded.
example: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/kaakcn/move_input_video.mp4
watermark:
type: boolean
description: Whether to add a "Generated by Qwen AI" watermark in the lower-right corner of the video.
default: false
example: true
parameters:
$ref: "#/components/schemas/ImageToAnimationParameters"
ImageToAnimationParameters:
type: object
required:
- mode
description: Video generation parameters.
properties:
mode:
type: string
description: |-
The service mode.
- `wan-std`: Standard mode. Faster generation at lower cost. Suitable for quick previews and basic animation.
- `wan-pro`: Professional mode. Smoother animation and higher quality, with longer processing time and higher cost.
enum:
- wan-std
- wan-pro
example: wan-std
check_image:
type: boolean
description: Whether to validate the input image.
default: true
example: true
AsyncTaskSubmitResponse:
type: object
description: Response from an asynchronous task submission.
properties:
request_id:
type: string
description: Unique request identifier for tracing and troubleshooting.
example: 4909100c-7b5a-9f92-bfe5-xxxxxx
output:
type: object
properties:
task_id:
type: string
description: Task ID for polling status. Use with `GET /tasks/{task_id}`. Valid for 24 hours.
example: 0385dc79-5ff8-4d82-bcb6-xxxxxx
task_status:
type: string
description: Initial task status, typically `PENDING`.
enum:
- PENDING
- RUNNING
- SUCCEEDED
- FAILED
- CANCELED
- UNKNOWN
example: PENDING
TaskStatusResponse:
type: object
description: Response from polling a task's status.
properties:
request_id:
type: string
description: Unique request identifier.
example: a67f8716-18ef-447c-a286-xxxxxx
output:
type: object
properties:
task_id:
type: string
description: The task ID.
example: 0385dc79-5ff8-4d82-bcb6-xxxxxx
task_status:
type: string
description: "Current task status. Transitions: PENDING → RUNNING → SUCCEEDED or FAILED. UNKNOWN means the task does not exist or has expired."
enum:
- PENDING
- RUNNING
- SUCCEEDED
- FAILED
- CANCELED
- UNKNOWN
submit_time:
type: string
description: "Time when the task was submitted. UTC+8 format: YYYY-MM-DD HH:mm:ss.SSS."
example: 2025-09-18 15:32:00.105
scheduled_time:
type: string
description: "Time when the task started running. UTC+8 format: YYYY-MM-DD HH:mm:ss.SSS."
example: 2025-09-18 15:32:15.066
end_time:
type: string
description: "Time when the task completed. UTC+8 format: YYYY-MM-DD HH:mm:ss.SSS."
example: 2025-09-18 15:34:41.898
results:
type: object
description: Task results. Returned only when `task_status` is `SUCCEEDED`.
properties:
video_url:
type: string
description: URL of the generated video. Valid for 24 hours. Download promptly. MP4 format with H.264 encoding.
example: https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxxxx.mp4?Expires=xxxxxx
code:
type: string
description: Error code. Returned only when the task fails.
message:
type: string
description: Detailed error message. Returned only when the task fails.
usage:
type: object
description: Output statistics. Returned only for successful tasks.
properties:
video_duration:
type: number
description: Duration of the generated video in seconds.
example: 5.2
video_ratio:
type: string
description: The service mode used. `standard` for `wan-std`, `pro` for `wan-pro`.
enum:
- standard
- pro
example: standard
DashScopeErrorResponse:
type: object
description: DashScope API error response.
properties:
request_id:
type: string
description: Unique request identifier.
code:
type: string
description: Error code (e.g., `InvalidApiKey`, `InvalidParameter`, `Throttling`).
example: InvalidApiKey
message:
type: string
description: Human-readable error message.
example: No API-key provided.