Skip to content

yzsp-studio/mediakit-shared-suite / mediakit-image

mediakit-image

Verified

面向单张或批量图片的视觉处理、质量优化、内容理解与基础编辑目标,适用于图片尺寸缩放与体积治理、质量优先缩小体积、明确体积上限/质量值/格式转换的压缩、元信息探测、裁剪旋转翻转与圆角、颜色与锐化清晰度调整、负片、模糊与打码、水印、背景移除、文字识别、画质评估与智能裁剪等。若对象和目标族已明确属于图片优化、图片理解、图片隐私保护或图片基础编辑,但具体做法不确定,可先加载本 Skill 探索;若只说有图片而未说明业务目标,应先澄清。视频画面裁剪、字幕压制、混音合流或视频局部模糊等成片编辑应路由到 editing;视频抽帧、视频理解、视频增强或视频字幕擦除应路由到 video。

reference/remove-image-background.md

View on GitHub
# 图像背景移除

## 能力用途

自动识别并保留图像主体,移除背景后生成背景透明的图片,用于图像背景移除(抠图)。

## 参数填写规则

- 提交一张公网可访问图片 URL,并指定背景移除场景;human 适用于真人人像主体抠图,product 适用于商品主体抠图,general 适用于不确定主体分类或动漫/二次元、商标/Logo、非纯色背景通用物品等场景,也可在 human/product 效果不佳时改用。human/product 支持描边和透明背景裁剪。 可选参数仅在用户明确指定,或可从用户意图准确确定时填写;不得伪造。不能准确确定时省略,确为正确完成任务所必需时先向用户澄清。

## Cloud

### 命令与生命周期

- 命令:`mediakit-cli image remove-image-background`
- 生命周期:同步
- 返回方式:直接返回 Cloud 业务结果。

### 使用指南

- 布尔参数(`--need-contour`、`--need-crop-background`)只能写成 `--need-contour=true` 或 `--need-contour=false`,也可用裸 `--need-contour`(等价 true);禁止空格传值 `--need-contour true`,否则该值会被当作位置参数。
- 布尔参数取默认值时直接省略,不要显式重复默认值。

### 调用示例

```bash
mediakit-cli image remove-image-background \
  --image-url <image_url> \
  --scene <scene>
```

仅使用用户真实输入替换占位符;可选 flag 遵守参数填写规则,不得编造 URL、文件、枚举或业务参数。

### 参数

| 参数路径 | CLI flag | 类型 | 必填 | 默认值 | 枚举/范围/结构 | 说明 |
| --- | --- | --- | --- | --- | --- | --- |
| `contour_color` | `--contour-color` | string | 否 | "#FFFFFF" | 格式: "^#[0-9a-fA-F]{6}$" | 主体描边颜色,使用十六进制 RGB,默认 #FFFFFF;仅当 need_contour 为 true 且 scene 为 human 或 product 时生效。 |
| `contour_size` | `--contour-size` | integer | 否 | 10 | 最小值: 1;最大值: 100 | 主体描边宽度,单位 px,范围 1 至 100,默认 10;仅当 need_contour 为 true 且 scene 为 human 或 product 时生效。 |
| `image_url` | `--image-url` | string | 是 | - | - | 待处理的图像 URL,支持公网 HTTP/HTTPS URL、本地文件路径、火山引擎对象存储 tos:// 三种输入协议;支持 .png、.jpg、.jpeg、.webp、.tiff、.bmp 和 .heic 格式;单张图片不得超过 30 MB,输入图像宽*高总像素上限≤40 MP;如 scene 选择 general,则图像输入分辨率的长边不得超过 10240 px、短边不得超过 6000 px;如 scene 选择 human 或 product,则图像输入分辨率的长边不得超过 7680 px、短边不得超过 4320 px。 |
| `need_contour` | `--need-contour` | boolean | 否 | false | - | 是否为主体生成描边,默认 false;仅在 scene 为 human 或 product 时生效,在 general 场景下会被忽略。 |
| `need_crop_background` | `--need-crop-background` | boolean | 否 | false | - | 是否将输出图片的透明背景裁剪到刚好包裹住主体,默认 false;仅在 scene 为 human 或 product 时生效,在 general 场景下会被忽略。 |
| `output_format` | `--output-format` | string | 否 | "png" | 枚举: ["png","jpeg","webp"] | 输出图片格式可用 png、jpeg、webp,默认 png;png 支持透明背景,webp 支持透明背景,jpeg 不支持透明背景,jpeg 的透明区域将填充为黑色。 |
| `queue_id` | `--queue-id` | string | 否 | - | - | 任务提交的目标队列 ID。如不传,默认使用系统自动创建的队列 ID。可将不同业务或优先级的任务提交到不同队列,以实现按队列对应的项目分账。队列可创建和管理,系统会自动为队列分配队列 ID。 仅在用户明确提供该值时传递;不得由 Agent 生成、推断或补写。 |
| `scene` | `--scene` | string | 是 | - | 枚举: ["general","human","product"] | 背景移除场景可用 general、human、product;human 为真人人像抠图场景,适用于仅需抠出图像中的真人人像主体的场景;product 为商品抠图场景,适用于仅需抠出图像中的商品主体的场景;general 为通用场景,适用于期望抠出图像主体,但不确定该主体所属分类的场景。如涉及动漫/动画/二次元素材、商标/Logo、非纯色背景的通用物品抠出场景,建议优先使用该场景模型。如针对多人人像或复杂背景商品主体抠出场景,使用 human 或 product 模型效果不佳,可换用该模型再次尝试处理。 |

### 返回结果

| 字段路径 | 类型 | 必含 | 模式 | 说明 |
| --- | --- | --- | --- | --- |
| `image_format` | string | 否 | Cloud | 生成图像的格式。 |
| `image_height` | integer | 否 | Cloud | 生成图像的高度,单位 px。 |
| `image_size` | integer | 否 | Cloud | 生成图像的大小,单位为字节。 |
| `image_url` | string | 否 | Cloud | 背景移除后的图片下载 URL,有效期 24 小时。 |
| `image_width` | integer | 否 | Cloud | 生成图像的宽度,单位 px。 |

### 机器合同

以下命令只读取本模式的实时 help/schema,不发起业务调用:

```bash
mediakit-cli image remove-image-background --help
mediakit-cli image remove-image-background --schema
```
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall