SuperAPI AI Directory

meitu-id-photo

Design & creation

View repository

Updated 10-16 00:23

About this skill

Overview

This skill adopts the "ID photo and portrait photo set" decision-making approach, but execution uniformly converges to the existing public template toolset:

  • Standard ID photo:image-edit
  • Change the ID background color of an existing photo:image-edit
  • Single-person portrait / three-panel portrait / themed scene portrait:image-portrait-generate

There are only two core principles: ID photos seek "accurate specifications, no identity drift, and no excessive beautification"; portraits seek "looking like the person, a clear style, and convincing photographic quality."

Before execution, the user should be clearly informed that: this Skill will read Meitu credentials, call the local meitu CLI, send the portrait photo, generation prompts, and task parameters to the Meitu OpenAPI, and write the generation results to ./output/ or $VISUAL/output/meitu-id-photo/. In ID photo scenarios, only the information necessary for the current task is collected; names, gender, or other identity fields are not persisted unless necessary.

Dependencies

  • meitu-cli (>=2.0.6): npm install -g meitu-cli@latest
    • Preferred environment variable:MEITU_OPENAPI_ACCESS_KEY / MEITU_OPENAPI_SECRET_KEY
    • Or a preset credential file:~/.meitu/credentials.json
    • If manual initialization of local credentials is needed, you may explicitly execute meitu config set-ak --value "..." + meitu config set-sk --value "..."(will write to a local file)
    • Verification:meitu auth verify --json
  • Environment variable:MEITU_OPENAPI_TOOL_TASK_MODE=command

Path alias: Below, $VISUAL = {OPENCLAW_HOME}/workspace/visual/

Core Workflow

Preflight -> Intent Routing -> Execute -> Refine -> Deliver -> [Record]

Preflight

  1. meitu --version -> if not installed, prompt npm install -g meitu-cli@latest
  2. meitu auth verify --json -> if credentials are invalid, guide configuration
  3. Detect mode: cwd has openclaw.yaml -> project mode; else -> one-off Check $VISUAL directory -> determine capabilities can_record = cwd has openclaw.yaml AND $VISUAL exists (if either is missing, false)
  4. output_dir resolution (MUST be completed within Preflight): Resolve output_dir: openclaw.yaml -> ./output/ | else -> $VISUAL/output/meitu-id-photo/ mkdir -p {output_dir}

Hard constraints: {output_dir} Pointing inside the skill folder is prohibited. output/ is always outside the skill folder. All in Execute --download-dir {output_dir} use the path resolved here.

Intent Routing

First determine which type of task the user wants, and follow only one path:

User request Tool path
Standard ID photo (specified specifications) image-edit
Existing ID photo / portrait with only the white, blue, or red background changed image-edit
Portrait photo / artistic photo / themed scene portrait image-portrait-generate
Three-panel portrait (same person in multiple poses, same theme and same outfit) image-portrait-generate

Boundaries:

  • Group photos / multi-subject scene remakes: not handled by this skill
  • Cartoonization, illustration style, 3D avatar: switch to the corresponding stylization capability
  • Ordinary portrait beautification, local facial retouching, light retouching: switch to the general portrait retouching capability

Execute

Path A: Standard ID photo

Applicable conditions: the user explicitly wants standard specifications such as one-inch, two-inch, passport, visa, ID card, driver's license, school enrollment, marriage certificate, or work badge, or explicitly says "make an ID photo."

Execution rules:

  1. Missing photo -> prompt to upload a frontal single-person portrait
  2. User only says "make an ID photo" without specifying specifications -> ask for the specifications, prioritizing common options: one-inch / two-inch / passport
  3. Background color not specified -> infer the default background according to the specifications; if it cannot be inferred, default to white background
  4. ID photos do not pursue beautification or reshaping; only necessary clothing changes, background changes, and compliant cropping are accepted
  5. When national/platform specifications conflict, clarification must be made first; for example, "China 1-inch" and "US visa photo" cannot be mixed up

Common specifications:

Purpose Size Background
China standard 1-inch 25x35mm / 295x413px Blue / Red / White
China standard 2-inch 35x49mm / 413x579px Blue / Red / White
China passport 33x48mm / 390x567px White
US visa / passport 51x51mm / 600x600px White
Japan resume 30x40mm White
Work ID / Student ID 22x32mm or 25x35mm White

Continue reading for complete specifications references/spec-database.md。

Command:

meitu image-edit \
  --skill_name skill_meitu-id-photo \
  --image_list {user_photo_url} \
  --prompt "{id_photo_prompt}" \
  --model praline_pro \
  --json \
  --download-dir {output_dir}

{id_photo_prompt} is a prompt generated at runtime, not a fixed constant. Template key points:

  • Specify the specification size, solid-color background, frontal eye-level view, and half-body or above-shoulder composition
  • Emphasize preserving the original facial identity features, not changing facial proportions, not slimming the face, and not enlarging the eyes
  • Only allow lighting equalization, clothing replacement, solid-color background replacement, and ID photo composition adjustment
  • Avoid descriptions such as "portrait feel," "premium feel," and "refined makeup" that would push the result toward artistic portraiture

Example prompt:

输出 {spec_name} 标准证件照,尺寸 {spec_size},{color_name} 纯色背景,人物正面平视居中,肩部以上或标准半身证件构图,严格保持原五官身份特征与脸型比例,不做美颜美型,不瘦脸,不放大眼睛,不改变鼻子和嘴型,仅做光线均匀化、背景纯色替换、服装整理为 {attire_desc},整体真实自然清晰。

Clothing selection:

Scenario attire
Default Dark formal jacket paired with a white collared shirt
Men's professional photo Dark blue suit jacket paired with a white collared shirt and dark tie
Women's professional photo Black professional suit jacket paired with a white crew-neck shirt
User-defined Fill in according to the user's description

Path B: ID photo background replacement

Applicable conditions: The user already has a basically qualified portrait or ID photo and only requests changing it to a white / blue / red background, without requesting new clothing or major reconstruction.

Execution rules:

  1. Only change the background; do not actively change the face, do not actively change the body, and do not actively apply portrait-style processing
  2. Output does not support transparent backgrounds
  3. If the user requests "change the background while also changing into formal attire and recropping to specifications" -> switch to Path A

Command:

meitu image-edit \
  --skill_name skill_meitu-id-photo \
  --image_list {user_photo_url} \
  --prompt "{bg_replace_prompt}" \
  --model praline_pro \
  --json \
  --download-dir {output_dir}

{bg_replace_prompt} is a prompt generated at runtime. Background description quick reference:

  • White background:纯白色背景(#FFFFFF)均匀铺满
  • Blue background:纯蓝色背景(#438EDB)均匀铺满
  • Red background:纯红色背景(#FF0000)均匀铺满

Example prompt:

将人物背景替换为 {color_name} 纯色证件照背景,背景均匀干净,无杂物无渐变,严格保持人物五官身份特征、发型、表情、服装和构图不变,不美颜不瘦脸不改五官,只做背景替换与轻微光线均匀化,输出自然真实。

Path C: Single-person portrait / three-panel portrait / themed portrait

Applicable conditions: The user wants a portrait photo, image photo, artistic photo, themed scene portrait, or three-panel portrait, rather than standard ID specifications.

Execution rules:

  1. Use the user's original image as the identity baseline; do not cause identity drift
  2. For portraits, clearly describe the theme, scene, clothing, lighting, and camera feel; avoid vague words
  3. A three-panel portrait should generate a three-panel composition within the same image at once, not be split into three images and then combined
  4. Default to realistic photographic texture; do not convert to cartoon and do not do poster layout

Command:

meitu image-portrait-generate \
  --skill_name skill_meitu-id-photo \
  --image_list {user_photo_url} \
  --prompt "{portrait_prompt}" \
  --size 2K \
  --json \
  --download-dir {output_dir}

{portrait_prompt} should be dynamically generated according to the user's theme:

  • Ordinary portrait:soft studio portrait, natural skin texture, {theme}, {outfit}, {lighting}, keep facial identity
  • Themed portrait: add clear scenes and photographic language, such as retro yearbook portrait, soft window light, vintage knitwear
  • Three-panel portrait: clearly describe vertical three-panel composition, same person, same outfit, three poses, consistent lighting

Refine

Make only the minimal changes based on the issues pointed out by the user:

Feedback Adjustment
Background color is wrong Change the background prompt and rerun
Specifications are wrong Change {spec_name} and the corresponding size description, then rerun
Clothing is wrong Change attire_desc and rerun
Doesn't look like the person Suggest replacing with a more frontal, clearer original image
Subject position is off Rerun once with the original path
Portrait style is not clear enough Add theme / lighting / clothing / scene, then rerun

Do not proactively perform secondary analysis or automatically rerun after a tool succeeds. Before the user is satisfied, it is recommended to iterate at most 3 rounds.

Deliver

output_dir has already been resolved in Preflight, and the file has been --download-dir downloaded to {output_dir}. In the JSON returned by the final step, downloaded_files[0].saved_path is the local file path. Deliver only renames:

mv "{downloaded_files[0].saved_path}" "{output_dir}/{date}_{output_label}.{ext}"

{ext} taken from the actual extension of downloaded_files[0].saved_path .

Naming suggestions:

  • ID photo:{YYYY-MM-DD}_{spec_name}_{color_name}.{ext}
  • Background color replacement:{YYYY-MM-DD}_id-photo-bg-{color_name}.{ext}
  • Portrait:{YYYY-MM-DD}_portrait-set.{ext}

Delivery description:

  • Standard ID photo: specify the specifications and background color, for example "2-inch blue-background ID photo"
  • Background color replacement: specify the new background color
  • Portrait: specify the theme and output type, for example "three-panel campus portrait"

Record (MUST in project mode / skip in one-off mode)

Prerequisite: can_record = cwd has openclaw.yaml AND $VISUAL exists (if either is missing, false). Not satisfied -> skip all recording, and feedback is valid only for the current conversation.

No feedback -> Skip entirely, do not read observations.yaml, zero overhead.

User approved style -> read $VISUAL/memory/observations/observations.yaml -> scan similar key -> merge or append -> write back. len(projects) >= 2 -> propose promotion (non-blocking):

"By the way, you prefer X across N projects. Do you want to save it? -> Save to scenario [default] -> Save to global preferences -> Do not save" User confirms -> write to $VISUAL/memory/scenes/{scope}.md or global.md,then delete observation key User ignores -> do nothing

User rejected ("do not XX") -> has openclaw.yaml -> ask scope -> project: DESIGN.md Constraints / universal: quality.yaml (requires user confirmation) no openclaw.yaml -> current task only, write nothing

Output

  • Format: taken from the actual downloaded file (usually JPG)
  • Naming: name according to the task type in Deliver
  • Location: determined by the Deliver step

Boundaries

This skill handles three types of tasks: "ID photos / ID background color replacement / single-person portrait sets", and does not do:

Not done Description
Multi-person group photos / multi-subject same-frame remakes Non-single-person ID photo / portrait scenarios
Cartoonization / illustration / 3D avatars Non-photographic realistic paths
Ordinary portrait light retouching / local skin smoothing / detailed facial feature retouching Not the main scenario of this skill
Poster design / typography Not portrait set generation

Judgment criteria:

  • The user's intent is "make a standard ID photo" -> Path A (image-edit)
  • The user's intent is "change this ID photo to a blue background" -> Path B
  • The user's intent is "to create a set of themed portraits / three-panel portraits that look like the person themselves" -> Path C