文档

图配文模型

更新时间:

用户只要输入背景图和文字,就能将文字排版到图片上,形成一张完整的图文海报。本文介绍图配文模型的输入输出参数。

使用场景

广告与营销:通过图配文模型,企业可轻松制作吸引眼球的广告海报与社交媒体宣传图,快速提升品牌曝光率和客户互动,推动销售转化。

艺术创作与设计:艺术家和设计师可以利用该模型将自己的作品与文字巧妙结合,创作出独特的艺术海报,增强作品的视觉效果。

个性化礼物定制:用户只需上传照片与祝福文字,模型便可生成个性化的礼物海报,适用于生日、节日等特殊场合,让礼物更具纪念意义,提升送礼体验。

模型概览

模型名

模型简介

计费单价

限流(含主账号与RAM子账号)

任务下发接口QPS限制

同时处理中任务数量

wanx-ast

用户只要输入背景图和文字,就能将文字排版到图片上,形成一张完整的图文海报。生成的图片文字布局合理,画面色彩和谐,支持任意宽高比的背景图片,提供多样化字体搭配。

限时免费

2

1

快速开始

图配文模型的输入输出参数,请参考图配文API参考

输入参数(input)

效果图

2

背景图(image_url)

标题(title):Lorem Ipsum

快速开始生成结果

副标题(subtitle)

Duis aute irure dolor in reprehenderit

其他文本(text): VIEW NOW

衬底数量(underlay):1

Logo素材(logo)

image

由于模型计算耗时较长,示例代码展示异步处理的调用方式,以避免请求超时。

您需要已获取API-KEY配置API-KEY到环境变量

curl

  1. 创建图配文任务

    curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis' \
    --header 'X-DashScope-Async: enable' \
    --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
    --header 'Content-Type: application/json' \
    --data '{
        "model": "wanx-ast",
        "input": {
            "title": ["Lorem Ipsum"],
            "subtitle": ["Duis aute irure dolor in reprehenderit"],
            "text": ["VIEW NOW"],
            "image_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240929/vbxgxc/2.png",
            "underlay": 1,
            "logo": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240927/abtbdg/logo.png"
        },
        "parameters": {
            "n": 1,
            "temperature": 0.7
        }
    }'
    
  2. 根据任务ID查询任务状态与结果

    curl -X GET \
    --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
    https://dashscope.aliyuncs.com/api/v1/tasks/{your-task-id}

输入限制

  • 标题与副标题:长度没有限制,为了生图效果最佳,建议两种类型标题的数量分别不超过3个,每个标题的字符数不超过30。

  • 其他文本:长度没有限制,为了生图效果最佳,建议数量不超过3个,每个文本的字符数不超过30。

  • 背景图:模型支持任意宽高比的图片,图像分辨率建议不超过3840 x 2160,文件大小不超过50MB,目前支持PNG、JPG格式。

  • Logo素材:模型支持任意宽高比的图片,图像分辨率建议不超过1280 x 1280,文件大小不超过5MB,且仅支持PNG格式。

更多示例

背景图(image_url)

效果图

输入参数(input)

image

image

 "input": {
        "title": ["Lorem Ipsum"],
        "subtitle": ["Duis aute irure dolor in reprehenderit in voluptate"],
        "text": ["Excepteur Sint"],
        "image_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240929/olwacd/%E7%A4%BA%E4%BE%8B%E5%9B%BE%E5%8E%9F%E5%9B%BE3.png",
        "underlay": 1,
        "logo": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240927/abtbdg/logo.png"
    },

image

image

"input": {
        "title": ["Lorem Ipsum"],
        "subtitle": ["Duis aute irure dolor in reprehenderit in voluptate"],
        "text": ["Excepteur Sint"],
        "image_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240927/jmitff/%E7%A4%BA%E4%BE%8B%E5%9B%BE%E5%8E%9F%E5%9B%BE1.png",
        "underlay": 1,
        "logo": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240927/abtbdg/logo.png"
    },

示例图原图2

生成图2

"input": {
        "title": ["Fashin Romance"],
        "subtitle": ["The summer new arrival"],
        "image_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240927/gtbcnr/%E7%A4%BA%E4%BE%8B%E5%9B%BE%E5%8E%9F%E5%9B%BE2.png",
        "underlay": 0,
        "logo": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240927/abtbdg/logo.png"
    },