SuperAPI AI Directory

image-cutout

Design & creation

View repository

Updated 10-16 09:32

About this skill

Image cutout (image-cutout)

Overview

Precisely separate the foreground subject from the background for an existing image. Only the five subject categories—people, pets, products, icons, and seals—can invoke SOD, and a transparent-background PNG is output; for non-five-category subjects and white-background isolation, no alternative API is invoked.

DAG / API Mapping

  • DAG routing positioning: this is the existing Meitu tool route in dag_existing_tool_routes , not a newly created dag_native command; the parameters and execution contract are subject to tools[].cli .
  • CLI entry point:meitu image-cutout;image_url is required,model_type is optional.
  • MCP entry point:image_cutout,api_path=/v1/hydra_async,api_task_type=mtlab。
  • MCP external parameters:image_url is required;model_type is optional (0=portrait, 1=product, 2=graphic); if not passed, it is automatically determined by the model.
  • MCP internal fixed request:request_payload.parameter.api_path=/v1/sod_2c_async、function_path=image-cutout、use_fe_rgba=true。use_fe_rgba is not a user parameter and must not be exposed as a CLI option or required from the user.
  • The user parameters of CLI and MCP remain consistent;prompt、target_subject、exclude_subjects are both not external parameters.

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 already 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-cutout/;mkdir -p

Execute

Trigger signals / routing rules

Core judgment dimension:the subject type recognized by the Agent in the image。

Scenario Judgment keyword Route Output
Standard five-category subjects People/pets/products/icons/seals Transparent-background cutout path Transparent-background PNG
Non-standard subjects Buildings/plants/vehicles/food/furniture/others Return UNSUPPORTED_SUBJECT_CATEGORY Not invoked
The user explicitly requests a white background White background, pure white background Return UNSUPPORTED_SUBJECT_CATEGORY Not invoked
The subject type cannot be determined Cannot confirm whether it belongs to the five categories Confirm with the user first Not invoked

Decision order:

  1. The Agent first identifies whether the image subject belongs to the five supported categories
  2. If it belongs to the five categories → invoke via CLI meitu image-cutout; otherwise return unsupported
  3. When the user explicitly specifies a model, validate that model_type is 0、1 or 2; when not specified, omit this parameter and let the model automatically select the type

CLI parameters

Parameter Type Required Default value Description
image_url STRING Yes -- Image address. If missing → prompt "Please provide the image to be cut out"
model_type INTEGER No Automatically determined 0 Portrait,1 product,2 graphic; only these three values are allowed

MCP external parameters

Parameter Type Required Default value Description
image_url STRING Yes -- Single image to be processed
model_type INTEGER No Automatically determined 0 Portrait,1 Product,2 Graphic

The CLI has exposed the optional model_type; when not provided, the MCP automatically selects the type. Internally, the MCP must maintain use_fe_rgba=true;prompt、target_subject、exclude_subjects are not external MCP parameters.

Tool invocation

meitu image-cutout \
  --skill_name skill_image-cutout \
  --image_url <image_url> \
  --json \
  --download-dir {output_dir}

The above example omits --model_type, and the model automatically selects the type; when explicitly specifying a portrait, product, or graphic model, add --model_type 0、--model_type 1 or --model_type 2。

Batch processing

When batch processing an entire image directory,--model-type is an optional model parameter shared by all entries:

meitu batch image-cutout \
  --input-dir ./images \
  --output-dir ./outputs \
  --skill_name skill_image-cutout

When the entire batch needs to share a fixed model, add --model-type 0、--model-type 1 or --model-type 2; when omitted, the type is automatically selected.

When you need to specify a model per entry, use a JSON or YAML configuration. The entry field modelType(compatible alias model_type) maps to the single-command model_type:

version: 1
defaults:
  outputDir: ./outputs
items:
  - input: ./images/person.jpg
    modelType: 0
  - input: ./images/product.jpg
    modelType: 1

The default concurrency for batch processing is 3, and the output is .png; entries without modelType have their type automatically selected by the model.

Error degradation

Scenario Handling method
image_url missing Prompt "Please provide the image to be cut out", do not call
image_url inaccessible Return an invalid image link error, do not retry
model_type not provided Omit this parameter, and the model automatically selects the type
model_type is not 0、1、2 Return a parameter error, prompt the user to choose a valid model, do not call
No foreground subject detected (standard path) Return an error, prompting that a clear foreground subject is required
Transparent-background cutout path failed Retry once; if it still fails, return an error
Not one of the five subject categories or white-background isolation Return UNSUPPORTED_SUBJECT_CATEGORY, do not call, do not retry, do not degrade
Content compliance interception Return a compliance prompt, do not retry, do not degrade
The user says "replace with a transparent background" Although it contains "replace", the target is transparent → use this tool, not background replacement
Video input Reject, only images are supported

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}_{descriptive}_image-cutout.png

Output

  • Format: transparent-background PNG
  • Naming:{YYYY-MM-DD}_{descriptive}_image-cutout.png
  • Location: project → ./output/, one-time → $VISUAL/output/image-cutout/

Baseline Task ID

See references/task-id-baseline.md for the corresponding row.