Meitu cutout

From security-pride/MalSkills · View interactive version

Meitu cutout is an AI agent skill from the GitHub repository security-pride/MalSkills. 使用 meitu-cli 抠图,分离前景主体并生成透明背景图片。当用户提到抠图、去背景、透明背景、背景移除、cutout、remove background、提取主体时触发。

How to use this skill

Skill file

Meitu Cutout

Overview

调用 meitu image-cutout 从图片中分离前景主体,输出透明背景 PNG。支持人像、商品、图形三种模式,可自动检测。

Dependencies

路径别名: 下文中 $VISUAL = {OPENCLAW_HOME}/workspace/visual/

Core Workflow

Preflight → [Context: 跳过(工具型抠图,无创意自由度)] → Execute → Deliver

Preflight

  1. meitu --version → 未安装则提示 npm install -g meitu-cli
  2. meitu auth verify --json → 凭证无效则引导配置
  3. Detect mode: cwd has openclaw.yaml → project mode; else → one-off

检查 $VISUAL 目录 → 确定 capabilities

  1. output_dir 解析(Preflight 内 MUST 完成):

Resolve output_dir: openclaw.yaml → ./output/ | else → $VISUAL/output/meitu-cutout/

mkdir -p {output_dir}

Execute

输入解析

用户提供图片,支持两种形式:

如果用户只说"帮我抠图"但没给图片 → 问:"请提供需要抠图的图片(本地路径或 URL)"。

model_type 路由

| 用户意图 / 图片内容 | model_type | 说明 |

|---------------------|-----------|------|

| 人像、证件照、半身照 | 0 (portrait) | 人像优化,保留发丝细节 |

| 商品、产品、电商图 | 1 (product) | 产品边缘优化 |

| 设计素材、图标、插画 | 2 (graphic) | 图形/非照片类 |

| 不确定 / 未说明 | 不传 | 自动检测(推荐默认) |

规则:用户未指定类型时,不传 --model_type,让服务端自动检测。仅当用户明确说"这是人像/商品/图标"或图片来源明确(如"电商主图")时才指定。

工具调用

单张抠图:

meitu image-cutout --image {image_url_or_path} --json --download-dir {output_dir}

指定 model_type:

meitu image-cutout --image {image_url_or_path} --model_type {0|1|2} --json --download-dir {output_dir}

批量处理

用户提供多张图片时,逐张调用:

for img in {image_list}; do
  meitu image-cutout --image "$img" --json --download-dir {output_dir}
done

注意:image-cutout 每次只处理一张图,不支持 --image_list。

结果检查

解析 --json 输出:

错误降级

| 级别 | 动作 | 说明 |

|------|------|------|

| L1 | 切换 model_type | 自动检测失败时,依次尝试 0→1→2 |

| L2 | 检查图片格式/大小 | 确保图片可访问且非损坏 |

| L3 | 停止并报错 | 2 次连续失败后,输出 code + hint |

特殊错误:

Deliver

直接使用 Preflight 解析的 output_dir。

mv {file} {output_dir}/{date}_{name}_cutout.png

Output

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.