Overview
Receive a problematic image, automatically diagnose the three types of issues—image quality/portrait/content—plan the optimal repair pipeline, and call the meitu-cli toolchain in order to complete the repair. The core value isdiagnosis + chaining—the user does not need to know which tool to use, only needs to say "help me fix it."
Dependencies
- meitu-cli (>=2.0.6):
npm install -g meitu-cli@latest - Credential: prefer env
MEITU_OPENAPI_ACCESS_KEY/MEITU_OPENAPI_SECRET_KEY, or preset~/.meitu/credentials.json; only when the user explicitly requests writing local credentials, then executemeitu config set-ak/meitu config set-sk
Path alias: below,
$VISUAL={OPENCLAW_HOME}/workspace/visual/
Core Workflow
Preflight → [Context: 跳过] → Execute (诊断 → 规划 → 逐步执行) → Deliver
↑ 工具型 skill,无创意上下文需求,始终跳过 Context
Preflight
meitu --version→ if not installed, promptnpm install -g meitu-cli@latestmeitu auth verify --json→ if credentials are invalid, guide configuration- Detect mode: cwd has
openclaw.yaml→ project mode; else → one-off can_record = cwd has openclaw.yaml AND $VISUAL exists (if either is missing, false) - Resolve output_dir: openclaw.yaml →
./output/| else →$VISUAL/output/meitu-image-fix/mkdir -p {output_dir}
Context
Tool-type skill, no creative context requirement, always skip Context and go directly to Execute.
Execute
Diagnosis: look at the image + listen to the user
Determine the problem from two information sources:
Visual analysis(use the Read tool to read the image, multimodal recognition of issues):
| Observed phenomenon | Tag |
|---|---|
| Low resolution / obvious blur / compression aliasing / heavy noise | quality:blur |
| Visible watermark / semi-transparent text overlay | content:watermark |
| Passersby/clutter in the frame that are not part of the subject | content:unwanted-object |
| Typos in the text content | content:text-error |
| Defects in the background (messy/damaged/continuity error) | content:bg-flaw |
| Face visible + rough/dull skin with obvious acne marks | portrait:skin |
| Face visible + facial features can be optimized | portrait:feature |
User intent parsing(what the user says maps directly to a tag):
| User expression | Tag |
|---|---|
| "make it clearer" "super-resolution" "high definition" "blurry" "poor image quality" "old photo" | quality:blur |
| "remove watermark" "watermark" | content:watermark |
| "remove passersby" "remove clutter" "erase XX" | content:unwanted-object |
| "change text" "fix typo" "change X to Y" | content:text-error |
| "clean up the background" "messy background" | content:bg-flaw |
| "skin smoothing" "beauty retouching" "acne removal" "brighten" "skin" | portrait:skin |
| "make it more refined" "facial feature adjustment" | portrait:feature |
| "remove background" "cutout" "transparent background" | cutout |
| "fix it" "help me process it" (vague instruction) | Completely rely on visual analysis |
Merge the two information sources to obtain the final problem list.
Plan the repair pipeline
Execution order (hard constraint—wrong order will severely affect the result):
Phase 1: image-superres-enhance 先提升画质,后续操作在清晰图上效果更好
Phase 2: image-edit / cutout 内容修复在高清底图上精度更高
Phase 3: image-edit(gummy_pro) 人像精修放最后,避免被前面步骤的重编码破坏
Pipeline routing table:
| Problem tag | Phase | Tool | Command |
|---|---|---|---|
quality:blur |
1 | image-superres-enhance | meitu image-superres-enhance |
content:watermark |
2 | image-edit | meitu image-edit --model praline_pro |
content:unwanted-object |
2 | image-edit | meitu image-edit --model praline_pro |
content:text-error |
2 | image-edit | meitu image-edit --model praline_pro |
content:bg-flaw |
2 | image-edit | meitu image-edit --model praline_pro |
cutout |
2 | image-cutout | meitu image-cutout |
portrait:skin |
3 | portrait-retouch | meitu image-edit --model gummy_pro |
portrait:feature |
3 | portrait-retouch | meitu image-edit --model gummy_pro |
When there are multiple edit operations within Phase 2, execute them serially one by one (each uses the URL output by the previous step). When cutout coexists with other Phase 2 operations: edit first, then cutout (background removal should come after the content is fixed).
Confirm the pipeline with the user(for multi-step repair):
List the diagnosis results and plan steps, and proceed only after confirmation:
Diagnosis: image is blurry + has a watermark + facial skin texture is rough Repair plan: ① Super-resolution → ② Watermark removal → ③ Natural beautification Confirm to start?
The user raised only a single issue and the diagnosis is unambiguous → skip confirmation and execute directly.
Execute step by step
Chained invocation mechanism:
Add --jsonto each step, parse the returned JSON's media_urls[0] as the next step's --image_list input. Add --download-dir {output_dir} only to the last step to save locally. After adding --download-dir , the JSON output will have an extra downloaded_files array; directly take downloaded_files[0].saved_path to get the full path of the downloaded file, then rename it in the Deliver stage.
URL passing fallback: if the next step fails when using media_urls[0] as the --image_list input (UPLOAD_ERROR), first download to the system temporary directory and then retry with the local path:
curl -sL -o /tmp/meitu-fix-step{N}.{ext} {url}
meitu <command> --image_list /tmp/meitu-fix-step{N}.{ext} ...
Intermediate filesmustbe stored in /tmp/ or the system temporary directory;it is forbiddento store them in the skill folder or the directory where the source file is located. Clean up after the pipeline is complete:rm -f /tmp/meitu-fix-step*.{ext}。
Phase 1: Super-resolution — image-superres-enhance
Construct the --prompt content description based on the image subject:
| Subject type | --prompt |
Basis for judgment |
|---|---|---|
| Mainly a portrait | portrait photo |
The face is the visual focus |
| Product/object | e-commerce product image |
Products, food, close-ups of physical objects |
| Graphics/screenshots | text document or UI screenshot |
UI screenshots, text images, illustrations, icons |
| Uncertain | general image |
Default description when it cannot be determined |
meitu image-superres-enhance --image_url {input} --prompt "{content_description}" --json --skill_name skill_meitu-image-fix
Parse:ok: true → media_urls[0] pass to the next step.
ok: false → record the error,continue with the original imagefor subsequent steps (an upscale failure does not block the pipeline).
Phase 2: Content repair — image-edit / image-cutout
Each content issue corresponds to one edit instruction, executed serially one by one:
| Issue | --prompt example | Note |
|---|---|---|
| Watermark | "去除图片中的水印" |
A large watermark area may require 2 rounds |
| Passersby/clutter | "消除画面中的路人" / "去掉右下角的杂物" |
Describing the specific location works better |
| Text errors | "将文字'XXX'改为'YYY'" |
Specify the original text and the corrected text |
| Background flaws | "修复背景中的破损区域" |
Describe the specific area |
meitu image-edit --image_list {prev_url} --prompt "{instruction}" --model praline_pro --json --skill_name skill_meitu-image-fix
For each step, take media_urls[0] and pass it to the next step.
If the issue is background removal (cutout):
meitu image-cutout --image_url {prev_url} --json --skill_name skill_meitu-image-fix
This step can only be performed on people, pets, products, icons, and seals; when the subject model is clearly known, you may append --model_type 0、--model_type 1 or --model_type 2, otherwise omit it and let the model be selected automatically.
Phase 3: Portrait retouching — image-edit (gummy_pro)
meitu image-edit --image_list {prev_url} --prompt "{portrait_retouch_prompt}" --model gummy_pro --json --skill_name skill_meitu-image-fix
| User request | portrait_retouch_prompt |
|---|---|
| Natural retouching / minor flaws / everyday photos | natural portrait retouch, improve skin texture and facial details, keep facial structure unchanged |
| Explicitly requests strong effects / severe flaws / commercial use | strong but realistic portrait retouch, smoother skin and cleaner facial details, keep facial structure unchanged |
| Not explicitly stated | Use the natural retouching prompt by default |
Constraint:portrait retouch Only applicable to real single-person portraits. Skip this step and inform the user in the following cases:
- Multi-person images
- Non-real portrait (cartoon, illustration, stick figure, AI-drawn style)
- Face too small or unclear
When the server refuses, simply skip.
When there are both portrait:skin and portrait:feature → a single image-edit --model gummy_pro covers both (no need to call twice).
Final step download: add --download-dir {output_dir}to the last command of the pipeline to save the result file directly to local.
Error handling
Each step is handled independently; a single step's failure does not block the pipeline:
L1: 简化 prompt — 移除修饰语,保留核心指令(edit 步骤适用)
L2: 省略可选参数 — 如裁剪掉非必要修饰,让服务端按默认路由处理
L3: 跳过当前步骤 — 用上一步结果继续后续管线
L4: 连续 2 步失败 → 停止管线,将最后一个成功步骤的结果下载到 {output_dir} 交付,并说明哪些步骤未完成
L5: 首步即失败 → 检查凭证/余额,报错含 code + hint
Special error codes:
ORDER_REQUIRED→ prompt the user to top up, provide action_urlCREDENTIALS_MISSING→ prompt to configure AK/SK
Deliver
output_dir has already been pre-resolved in Preflight; the --download-dir of the last step in Execute has already been written directly to that directory, and Deliver only does rename.
mv {output_dir}/{task_id_file} {output_dir}/{date}_{effect}.{ext}
Record (MUST in project mode / skipped in one-off mode)
can_record = cwd has openclaw.yaml AND $VISUAL exists (missing either one means false) → skip when false. In one-off mode, feedback is only valid for the current conversation.
User approved style →
read $VISUAL/memory/observations/observations.yaml → scan similar key → merge or append → write back. len(projects) >= 2 → propose promotion (non-blocking)
→ non-blocking promotion proposal (mention at the end of the reply: "You prefer X in N projects, do you want to save it?") → confirmed → write target + delete observation
User rejected ("Don't XX") → has openclaw.yaml → ask scope → project: DESIGN.md Constraints / universal: quality.yaml (requires user confirmation) no openclaw.yaml → current task only
No feedback → skip entirely (do not read observations.yaml, zero overhead).
Output
- Format: consistent with input (jpg→jpg, png→png), cutout outputs png (with alpha channel)
- Naming:
{date}_{修复摘要}.{ext}- Single fix:
2026-03-23_upscale.jpg - Chained fix:
2026-03-23_upscale+remove-watermark+beauty.jpg
- Single fix:
- Location: determined by the Deliver step
Boundaries
This skill only doesfixing— making an existing image better. It does not do creative tasks:
| Do not | Hand off |
|---|---|
| Style transfer (turn into comic/oil painting/3D) | image-style-transfer(or via meitu-tools direct call) |
| Background/scene replacement (creative replacement) | image-background-replace or meitu-visual-me background replacement workflow |
| Poster layout/text layout | meitu-poster |
| AI portrait/portrait generation | image-portrait-generate or meitu-visual-me |
Boundary judgment: if the user's intent is "fix the problems with this image" → this skill. If the user's intent is "turn this image into something else" → inform the user and suggest the corresponding skill.