Image Face Swap logo

Image Face Swap

Organization
meitu
image-face-swap

双图换脸/换头合成,将源图人脸替换到目标场景图上,保留目标图构图、身体和背景并自动做肤色融合与光影匹配。仅在用户明确提供两张图,并表达换脸、换头、把 A 的脸换到 B 上、face swap 或明确的 P 脸合成意图时触发。执行时会使用本地 Meitu OpenAPI 凭证授权,并将源人脸图和目标场景图发送到 Meitu 外部服务处理。

Overview

Publishermeitu
Repositorymeitu-skills
Skill nameimage-face-swap
Stars
36
Forks
3
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by meitu on GitHub. Read the source before you install it.

Installation

Install the Image Face Swap AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/meitu/meitu-skills/tree/main/skills/image-face-swap
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/meitu/meitu-skills.git /tmp/meitu-skills
mkdir -p .claude/skills
cp -r /tmp/meitu-skills/skills/image-face-swap .claude/skills/image-face-swap
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Image Face Swap in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Image Face Swap on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Image Face Swap is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

图片换脸(image-face-swap)

Overview

双图换脸/换头合成,将源图人脸替换到目标场景图上。保留目标图的构图/身体/背景,自动肤色融合光影匹配;用于角色扮演、把自己的脸放到另一张图上、趣味合成。一次只换一张脸。

执行前应让用户清楚知道:本 Skill 会读取 Meitu 凭证、调用本地 meitu CLI、将两张人脸相关图片发送到 Meitu OpenAPI 处理,并把结果写入 ./output/ 或 $VISUAL/output/image-face-swap/。

API Mapping

  • 双图换脸/换头合成:image_face_swap

Dependencies

  • meitu-cli: >=2.0.6(npm install -g meitu-cli@latest)
  • 凭证:CONFIG AKSK → meitu tools update;EXEC AKSK → 实际执行(见根 CONFIG.md)
  • 环境变量:MEITU_OPENAPI_TOOL_TASK_MODE=command

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

Core Workflow

Preflight → Execute → Deliver

Preflight

  1. meitu --version ≥ 2.0.6(否则 npm install -g meitu-cli@latest)
  2. 确认已跑过 meitu tools update(用 CONFIG AKSK)
  3. 当前 AKSK = EXEC,且 MEITU_OPENAPI_TOOL_TASK_MODE=command
  4. 解析 output_dir:openclaw.yaml → ./output/ |else → $VISUAL/output/image-face-swap/;mkdir -p

Execute

触发信号 / 路由规则

核心判断维度:图片数量 + head/sence 角色分配。

场景判定路由
双图换脸提供 2 张图,意图换脸image_face_swap,head/sence 按规则分配

决策顺序:

  1. 图片数量:不足 2 张 → 提示补图;超过 2 张 → 取前 2 张并告知
  2. 角色分配:
    • 用户明确指定 → 按指定分配 head / sence
    • 未区分 → 第 1 张 = head(人脸源),第 2 张 = sence(场景底图)
    • "用 B 换到 A" → B=head(源),A=sence
  3. 唯一路由:调用 image_face_swap

单 API 工具:参数齐全即调用,失败重试 1 次后返回错误;不做跨工具兜底。侧脸/遮挡严重不阻断调用,但告知效果可能受限。

参数定义

参数类型必填默认值说明
head_image_urlSTRING是--人脸源图 URL
sence_image_urlSTRING是--场景底图 URL(保留构图/身体/背景)
promptSTRING是--附加提示词。缺失 → 提示"请描述换脸效果要求"

工具调用

bash
meitu image-face-swap \
  --skill_name skill_image-face-swap \
  --head_image_url <head_url> \
  --sence_image_url <sence_url> \
  --prompt "<effect_description>" \
  --json \
  --download-dir {output_dir}

错误降级

场景处理方式
图片不足 2 张提示"请提供两张图片:一张人脸源图,一张目标场景图"
图片 3+ 张取前 2 张(第 1=head,第 2=sence),告知用户
head_image_url / sence_image_url 不可访问返回图片链接无效错误,不重试
未检测到人脸(head)返回错误:人脸源图需包含清晰正脸
image_face_swap 调用失败重试 1 次,仍失败返回错误
内容合规拦截返回合规提示,不重试
侧脸 / 遮挡严重不阻断调用,告知效果可能受限
视频换脸拒绝,仅支持图片
多人同时换脸本工具一次只换一张脸

Deliver

  • 直接使用 Preflight 解析的 output_dir
  • 从 downloaded_files[0].saved_path 读取已下载文件路径
  • mv {downloaded_files[0].saved_path} {output_dir}/{YYYY-MM-DD}_{descriptive}_image-face-swap.jpg

Output

  • 格式:JPEG/PNG(保持原格式)
  • 命名:{YYYY-MM-DD}_{descriptive}_image-face-swap.jpg
  • 位置:项目 → ./output/,一次性 → $VISUAL/output/image-face-swap/

基线 Task ID

见 references/task-id-baseline.md 中对应行。

Frequently asked questions

What does the Image Face Swap AI skill do?

双图换脸/换头合成,将源图人脸替换到目标场景图上,保留目标图构图、身体和背景并自动做肤色融合与光影匹配。仅在用户明确提供两张图,并表达换脸、换头、把 A 的脸换到 B 上、face swap 或明确的 P 脸合成意图时触发。执行时会使用本地 Meitu OpenAPI 凭证授权,并将源人脸图和目标场景图发送到 Meitu 外部服务处理。

Why use Image Face Swap on TypingMind?

Because you install it once and use it with any model. Image Face Swap is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Image Face Swap in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/meitu/meitu-skills/tree/main/skills/image-face-swap. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Image Face Swap?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Image Face Swap?

As many as you like. As long as a model supports skills, you can use Image Face Swap with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Image Face Swap AI skill free?

Yes. It is published on GitHub by meitu under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇