---
title: "图像主体背景替换 AI Skill|万维易源ShowAPI"
canonical_url: "https://www.showapi.com/ai/skills/6a97b9f33c51f24167049bdc"
last_updated: "2026-09-02T06:40:02.454Z"
meta:
  description: "基于用户上传的主体图和背景图，使用固定的构图提示词调用默认生图引擎进行主体背景融合生成，并轮询获取最终图像结果。 免费在线使用，也支持 API / Agent 接入。"
  keywords: "图像主体背景替换 AI Skill Skills市场 AI技能 在线使用 API接入 api接口,api接口大全,免费api,免费数据接口,数据接口,api开放平台,万维易源,showapi,大模型,AI Skills"
  "og:description": "基于用户上传的主体图和背景图，使用固定的构图提示词调用默认生图引擎进行主体背景融合生成，并轮询获取最终图像结果。 免费在线使用，也支持 API / Agent 接入。"
  "og:title": "图像主体背景替换 AI Skill|万维易源ShowAPI"
---

*

*

*

*

# **图像主体背景替换**

基于用户上传的主体图和背景图，使用固定的构图提示词调用默认生图引擎进行主体背景融合生成，并轮询获取最终图像结果。

M**Marwen** 2026-09-02 14:09 · 3 个步骤

ID`6a97b9f33c51f24167049bdc`

### **能力组成**

**立即试一试** 在线体验此 Skill，输入参数即可看到实时效果

### **输出案例**

-
-
-
-

### **内部编排**

共 3 步 · AI 自动编排的执行流程与原始定义 收起

1合规校验优化

2调用默认生图引擎生成融合图片

3轮询图片生成状态

**完整定义 (JSON)**87 行

```
{
  "workflow_id": "image_subject_bg_replacement",
  "input": {
    "subject_image": {
      "field_name": "subject_image",
      "default": "",
      "description": "带核心主体的原图，支持传入标准 Base64 编码字符串或普通 URL。画面主体为核心对象。",
      "example": "https://oss.showapi.com/doc/4888/3/1cb69e35cac8_1779935636689.jpg?x-oss-process=image/resize,p_100",
      "type": "base64",
      "required": true
    },
    "bg_img": {
      "field_name": "bg_img",
      "default": "",
      "description": "替换用背景素材图，支持传入标准 Base64 编码字符串或普通 URL。场景、风景、室内外景等均可。",
      "example": "https://oss.showapi.com/doc/4888/163/5ac066bad35d_1788337495986.jpg?x-oss-process=image/resize,p_100",
      "type": "base64",
      "required": true
    },
    "aspect_ratio": {
      "field_name": "aspect_ratio",
      "default": "1:1",
      "description": "生成图像的宽高比，可选值：1:1、3:4、4:3、16:9、9:16",
      "example": "1:1",
      "type": "string",
      "required": false
    }
  },
  "steps": [
    {
      "point_code": "1",
      "id": "step_0_prompt_guardian",
      "api_code": "prompt_guardian",
      "backend_type": "sys_api",
      "status": "PENDING",
      "name": "合规校验优化",
      "action": "run",
      "params": []
    },
    {
      "id": "step_1_generate_image",
      "point_code": "1",
      "result": [],
      "backend_type": "sys_api",
      "api_code": "3373",
      "status": "PENDING",
      "name": "调用默认生图引擎生成融合图片",
      "action": "run",
      "params": {
        "referImages": [
          "{{@input.bg_img}}",
          "{{@input.subject_image}}"
        ],
        "prompt": "上传图像中的第一个图是背景图，第二个图是主体图，请将主体图背景替换为上传的背景图；要求：整体变得更好看；整体都提升，可以适当抹除干扰项，可以适当调整主体图、可以适当调整背景图；综合调整后要比原图更好；",
        "aspect_ratio": "{{@input.aspect_ratio}}"
      }
    },
    {
      "id": "step_2_poll_image_status",
      "point_code": "1",
      "result": [],
      "backend_type": "sys_api",
      "api_code": "polling",
      "name": "轮询图片生成状态",
      "action": "run",
      "params": {
        "result_url": "{{@step_1_generate_image.result.data.result_url}}"
      },
      "depends_on": [
        "step_1_generate_image"
      ],
      "polling": {
        "interval_seconds": 5,
        "timeout_seconds": 1200,
        "success_condition": "{{@step_2_poll_image_status.result.data.task_status}} === 'SUCCEEDED'"
      }
    }
  ],
  "output": {
    "result_image_url": {
      "field_name": "result_image_url",
      "description": "生成的最终融合图片URL",
      "value": "{{@step_2_poll_image_status.result.data.result_url}}",
      "type": "string"
    }
  }
}
```

介绍

在线运行

Skill与API