SuperAPI AI Directory

meitu-cutout

General & other

View repository

Updated 10-16 00:23

About this skill

Meitu Cutout

Overview

Call meitu image-cutout to separate the foreground subject from the image and output a transparent-background PNG. Only the five subject types are supported: people, pets, products, icons, and seals; optional portrait, product, and graphic models, or omit the model parameter to auto-detect.

Dependencies

  • meitu-cli: npm install -g meitu-cli@latest
  • Credentials: prefer env vars MEITU_OPENAPI_ACCESS_KEY / MEITU_OPENAPI_SECRET_KEY, or preset ~/.meitu/credentials.json; execute this only when the user explicitly asks to write local credentials. meitu config set-ak --value "..." / meitu config set-sk --value "..."

Path alias: below in the text $VISUAL = {OPENCLAW_HOME}/workspace/visual/

Core Workflow

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

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
  4. output_dir resolution (MUST be completed within Preflight): Resolve output_dir: openclaw.yaml → ./output/ | else → $VISUAL/output/meitu-cutout/ mkdir -p {output_dir}

Execute

Input parsing

The user provides an image, supporting two forms:

  • Local file path (e.g., ./photo.jpg)
  • Image URL (e.g., https://example.com/photo.jpg)

If the user only says "help me cut out the image" but does not provide an image → ask: "Please provide the image to cut out (local path or URL)."

Model selection

Image subject model_type Output
Portraits, ID photos, half-body photos 0 Transparent-background PNG, preserving hair detail
Products, merchandise, e-commerce images 1 Transparent-background PNG, optimizing product edges
Design assets, icons, seals 2 Transparent-background PNG
Pets or uncertain type Omit The server automatically selects the model and outputs a transparent-background PNG

model_type Only allowed 0、1、2. Non-five-category subjects such as architecture, plants, vehicles, food, and furniture, as well as white-background isolation, are not supported, and the restriction must not be bypassed via prompts or alternative APIs; when a white background needs to be generated, switch to image-edit。

Tool invocation

Single image cutout:

meitu image-cutout --image_url {image_url_or_path} --json --download-dir {output_dir} --skill_name skill_meitu-cutout

When a model is explicitly specified, append --model_type 0、--model_type 1 or --model_type 2; when omitted, automatically select the type.

Batch processing

Batch process an entire directory:

meitu batch image-cutout --input-dir {input_dir} --output-dir {output_dir} --skill_name skill_meitu-cutout

When the entire batch shares a fixed model, append --model-type 0、--model-type 1 or --model-type 2. When specifying item by item, use a JSON/YAML configuration; the item field modelType(compatible with model_type) maps to the single-command model_type. Batch processing default concurrency is 3, output .png。

Note: A single command does not support --image_list; input parameters only accept --image_url(alias --image)。

Result check

Parse --json output:

  • ok: true → success,downloaded_files[0].saved_path is the locally downloaded result PNG (transparent background); if not used --download-dir, then take media_urls[0]
  • ok: false → check code and hint

Error fallback

Level Action Description
L1 Adjust model selection When auto-detection is inaccurate, switch to --model_type 0、1 or 2
L2 Check image format/size Ensure the image is accessible and not corrupted
L3 Stop and report an error After 2 consecutive failures, output code + hint

If it is not one of the five subject types or white-background isolation, return unsupported directly; do not call or retry.

Special errors:

  • ORDER_REQUIRED → Prompt the user to top up, display action_url
  • CREDENTIALS_MISSING → Prompt to configure AK/SK

Deliver

Directly use the output_dir parsed by Preflight.

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

Output

  • Format: PNG (transparent background)
  • Naming: {YYYY-MM-DD}_{descriptive-name}_cutout.png
    • Example: 2026-03-23_product-photo_cutout.png
  • Location: Determined by the Deliver step (project → ./output/, one-time → $VISUAL/output/meitu-cutout/)