SuperAPI AI Directory

image-id-photo-generate

Design & creation

View repository

Updated 10-16 09:32

About this skill

ID Photo Generation (image-id-photo-generate)

Overview

Generate a standard ID photo in one click based on the user's photo + ID specification. Automatic outfit change (default black suit + white shirt) + background replacement + compliance adjustments (ears visible/forehead visible/background color/attire/size) + face_desc facial feature anchoring, to avoid excessive beautification of facial features by the general editing pipeline. Covers multiple specifications including 1-inch/2-inch/passport/visa/ID card/driver's license/school enrollment/graduation/professional/business/marriage certificate/work badge, etc.

Before execution, the user should be clearly informed that: this Skill will read Meitu credentials, call the local meitu CLI, send the portrait image and specification parameters provided by the user to the Meitu OpenAPI for processing, and write the results to ./output/ or $VISUAL/output/image-id-photo-generate/. ID photos involve sensitive facial and identity-related image data, and it should be confirmed that there is legal authorization for the person in the photo.

API Mapping

  • ID photo generation: fixed use of praline_pro, driven by the ID photo prompt template and specification mapping.

Dependencies

  • meitu-cli: >=2.0.6(npm install -g meitu-cli@latest)
  • Credentials:CONFIG AKSK → meitu tools update; EXEC AKSK → actual execution (see root CONFIG.md)
  • Environment variables:MEITU_OPENAPI_TOOL_TASK_MODE=command

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

Core Workflow

Preflight → Execute → Deliver

Preflight

  1. meitu --version ≥ 2.0.6 (otherwise npm install -g meitu-cli@latest)
  2. Confirm that meitu tools updatehas been run (using CONFIG AKSK)
  3. Current AKSK = EXEC, and MEITU_OPENAPI_TOOL_TASK_MODE=command
  4. Resolve output_dir: openclaw.yaml → ./output/ |else → $VISUAL/output/image-id-photo-generate/;mkdir -p

Execute

Trigger signals / routing rules

Core judgment dimensions:ID purpose determination + complete spec_type + complete parameters。

Decision order:

  1. image_url missing → ask follow-up;spec_type missing → display specification selection template
  2. Attire conflict check: ID card specification + white clothing without outerwear → forcibly change to black suit
  3. Observe the original image and fill in the 13 face_desc items (do not rely on impressions or default values)
  4. Construct prompt (face_desc + attire_desc + bg_desc + compliance instructions + negative constraints) → fixed use of praline_pro

Priority rules: explicit ID photo purpose > general portrait; complete ID photo required (outfit change + background change + compliance) > background change only. On failure, simplify the prompt and retry, up to 3 rounds.

Parameter definitions

Parameter Type Required Range Default value Description
image_url STRING Yes -- -- User's frontal portrait photo. Missing → prompt to provide image
spec_type STRING Yes 1-inch/2-inch/passport/ID card/visa/driver's license/kindergarten enrollment/marriage certificate/professional/business -- ID specification. Missing → display inquiry template
bg_color STRING No White/blue/red/gray-white gradient/gray gradient Automatically adapts by specification Background color
attire STRING No See clothing preset table Black suit + white shirt Attire, ≤15 character description
model STRING Fixed praline_pro praline_pro ID photo fixed model, not configured by the user

spec_type → internal parameter mapping:

spec_type ratio Background Compliance level Compliance instructions
1-inch/Postgraduate exam/Civil service exam/Teacher qualification/Resume 3:4 White/Blue Strict Both ears visible, forehead visible, both eyebrows visible
2-inch/Graduation certificate 3:4 Blue Moderate Both ears visible, forehead visible
Passport/Visa 3:4 White Strict Both ears visible, forehead visible, both eyebrows visible
ID card 4:5 White Strict Both ears visible, forehead visible, both eyebrows visible
Driver's license 3:4 White Strict Both ears visible, forehead visible, both eyebrows visible
Kindergarten enrollment/Enrollment photo 3:4 White/Blue Moderate Both ears visible, forehead visible
Marriage certificate 3:4 Red Loose Do not add
Professional ID photo/Smart ID photo 3:4 Gray-white gradient Loose Do not add
Business/Image photo 3:4 Gray gradient None Do not add

face_desc 13 items(Fill in the blanks in order; vague words such as "moderate/medium/slightly curly" are prohibited): ①Face shape ②Face width ③Cheekbones (write if prominent) ④Chin ⑤Nose ⑥Eyes (size + shape + single/double eyelid + spacing) ⑦Lips ⑧Skin tone ⑨Glasses (if worn, write "wears glasses") ⑩Hair color ⑪Hair texture ⑫Hair length ⑬Parting.

Correct example:宽圆脸偏宽,下巴短而圆润,鼻子偏宽鼻头圆,眼睛偏大圆眼内双,嘴唇偏薄,肤色偏黄有黑眼圈,戴眼镜,深棕色直发中长发侧分

Prohibited words: moderate (nose), medium (eyes), slightly curly (when uncertain), mole/birthmark/scar, "ID photo" (use "ID photo composition" instead), "do not enlarge the eyes" (to avoid reverse understanding by the editing model).

Prompt template (standard version, no glasses):

严格保持人物面部骨骼结构五官比例与原照片完全一致,面部辨识度为最高优先级,{face_desc},保持原有发型和表情不变,保持原有瞳色不变,保留皮肤纹理细节。
仅更换服装和背景:{attire_desc},{bg_desc}。{compliance_desc}模拟85mm镜头柔和自然光皮肤质感通透贴近真实肤色,人物居中正面直视镜头免冠标准{spec_name}证件构图高清锐利。
不要瘦脸不要缩小鼻子不要改变眼睛大小形状不要尖化下巴不要改变五官比例不要改变五官位置不要磨皮美白不要改变脸型不要改变嘴唇厚度不要改变发型不要改变发色不要添加眼镜不要添加任何装饰物不要添加发饰不要生成手持物品不要消除皮肤纹理不要模糊不要滤镜

Wearing glasses: Line 1 "keep the original hairstyle, glasses, and expression unchanged"; Line 3 "do not change the glasses." There are also a professional ID photo version and a conservative infant version.

bg_desc quick reference: White→纯白色背景均匀铺满 / Blue→纯蓝色背景均匀铺满 / Red→纯红色背景均匀铺满 / Gray-white gradient→淡灰到白色从上到下柔和渐变摄影背景 / Gray gradient→灰色从上到下渐变背景顶部深灰底部浅灰。

compliance_desc: Strict→双耳露出额头露出双眉可见, / Moderate→双耳露出额头露出, / Loose or none→delete, leaving no blank.

Tool invocation

meitu image-id-photo-generate \
  --skill_name skill_image-id-photo-generate \
  --image_url <image_url> \
  --spec_type <一寸|二寸|护照|身份证|...> \
  --bg_color <白|蓝|红|灰白渐变|灰渐变> \
  --attire "<黑西装+白衬衫>" \
  --model praline_pro \
  --json \
  --download-dir {output_dir}

Error fallback

Scenario Handling method
spec_type missing Display the specification selection template for the user to choose
image_url missing Prompt "Please provide a frontal portrait photo"
attire missing Default to "black suit + white shirt" and start directly, without additional questions
Clothing conflict (ID card + white clothes without outerwear) Force change to black suit (white clothes conflict with white background)
face_desc written inaccurately → beautify the face Must carefully observe the original image and fill in anchored facial features
praline_pro invocation failed Streamline the prompt and retry → up to 3 rounds → if still failing, suggest changing the photo
Content compliance interception Return a compliance prompt
User feedback that it does not look like the person Redo with minimal changes according to the "feedback correction rules"
User wants super-resolution / exact pixels Subsequently use super-resolution/canvas adaptation capabilities (not default)

Iron rules for feedback correction: minimal changes (only fix the issues the user pointed out) / no blind guessing / first-version baseline (if later versions are worse than the first version, roll back immediately) / confirm before changing / re-observe the original image / positive-driven (modify face_desc, not just negative constraints).

Exact pixel quick reference: 1-inch 295×413 / 2-inch 413×579 / ID card 358×441 / passport 390×567 / small 1-inch 260×378.

Deliver

  • Directly use the output_dir parsed by Preflight
  • From downloaded_files[0].saved_path read the downloaded file path
  • mv {downloaded_files[0].saved_path} {output_dir}/{YYYY-MM-DD}_{spec_type}_image-id-photo-generate.jpg

Output

  • Format: JPEG (default)
  • Naming:{YYYY-MM-DD}_{spec_type}_image-id-photo-generate.jpg
  • Location: project → ./output/, one-time → $VISUAL/output/image-id-photo-generate/

Baseline Task ID

See the corresponding line in references/task-id-baseline.md .