SuperAPI AI Directory

image-transform

Design & creation

View repository

Updated 10-16 00:23

About this skill

Image Transform

Overview

Perform geometric transformation on an existing image (without changing the image content). 4 types of scenarios: rotation/flipping (-180°~180°), proportional enlargement (2/4/8 times), lossless proportional reduction, intelligent composition/canvas extension/size transformation (AI outpainting). Key distinction: "enlarge by N times/reduce to 800 width/outpaint/change size" goes through this tool; "enlarge to 4K" (resolution target) goes through image-superres-enhance.

API Mapping

  • Rotation/flipping:api_v1_layer_flow_edit_rotate
  • Proportional enlargement:image_upscale_equal_proportion_edit
  • Lossless reduction:image_dldownscaling_edit
  • Intelligent composition / canvas extension / size transformation:image_extension_layer_flow_filter

Dependencies

  • meitu-cli: >=2.0.6
  • 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
  2. Already ran with CONFIG AKSK meitu tools update
  3. Current AKSK = EXEC,MEITU_OPENAPI_TOOL_TASK_MODE=command
  4. output_dir:openclaw.yaml → ./output/ |else → $VISUAL/output/image-transform/;mkdir -p

Execute

Trigger signals / routing rules

Core dimensions:Operation intent branches。

Scenario Decision keywords Routing
Rotation / flipping rotate, clockwise, counterclockwise, flip, mirror api_v1_layer_flow_edit_rotate
Proportional enlargement (multiple) enlarge 2/4/8 times, proportional enlargement image_upscale_equal_proportion_edit
Lossless reduction reduce to xxx, lossless reduction image_dldownscaling_edit
Intelligent composition / canvas extension / aspect ratio change / size transformation outpaint, change to 16:9, portrait to landscape, outpaint, intelligent composition, recomposition, adjust to specified width and height image_extension_layer_flow_filter

Routing principle: reduction target > original image → automatically switch to image_upscale_equal_proportion_edit; reduction target = original image → directly return the original image.

Parameter definitions

General:

Parameter Type Required Description
image_url STRING Yes Image URL

api_v1_layer_flow_edit_rotate:

Parameter Type Range Default Description
rotate NUMBER -180 ~ 180 0 Rotation angle; automatically clamped if out of range
flip_x BOOLEAN true/false false Horizontal flip
flip_y BOOLEAN true/false false Vertical flip

image_upscale_equal_proportion_edit:

Parameter Type Range Default Description
sr_num INTEGER 2 / 4 / 8 2 Enlargement factor; invalid values take the nearest valid value (3→2, 6→8)

image_dldownscaling_edit:

Parameter Type Description
target_width INTEGER Target width (pixels px, do not pass ratio numbers)
target_height INTEGER Target height (pixels px, do not pass ratio numbers)
  • Only one side given → calculate the other side according to the original image ratio
  • Target > original image → automatically switch to image_upscale_equal_proportion_edit
  • Target = original image → directly return the original image

image_extension_layer_flow_filter:

Parameter Type Default Description
width INTEGER -- Target width (pixels px, ratio numbers are prohibited)
height INTEGER -- target height (pixels px, ratio numbers are prohibited)
prompt STRING keep the original image style for natural extension extension/refactoring region AI completion description

width/height must be absolute pixel values: user says "16:9" -> calculate pixels based on original image dimensions (example: original image 1024×768, 16:9 -> width=1024, height=576); if only "outpainting" is said with no specific value -> by default calculate based on 3:4 ratio. Outpainting scenario target < original image -> do not call, prompt "target size must be greater than original image size".

Tool invocation

# 旋转
meitu image-transform --image_url <url> --rotate 90 --json --download-dir {output_dir} --skill_name skill_image-transform
# 等比放大
meitu image-transform --image_url <url> --sr_num 4 --json --download-dir {output_dir} --skill_name skill_image-transform
# 缩小
meitu image-transform --image_url <url> --target_width 800 --json --download-dir {output_dir} --skill_name skill_image-transform 
# 扩图
meitu image-transform --image_url <url> --width 1920 --height 1080 --json --download-dir {output_dir} --skill_name skill_image-transform

Error fallback

Scenario Handling method
image_url missing prompt "please provide the image to be transformed"
image_url inaccessible directly return an invalid image link error, do not retry
rotate out of range -180~180 automatically clamp
sr_num invalid take the nearest valid value
downscale target > original image automatically switch to image_upscale_equal_proportion_edit
downscale target = original image do not call, directly return the original image
downscale only one side given calculate the other side according to the original image ratio
outpainting target < original image do not call, prompt "target size must be greater than original image size"
smart composition/size transformation missing width/height and cannot be inferred from ratio prompt "please provide the target width and height or target ratio"
any API call fails retry once, if still fails return error
content compliance interception directly return compliance prompt, do not retry, do not fall back
rotate + outpaint at the same time recommend step-by-step operation: rotate first, then outpaint

Deliver

  • 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-transform.{ext}

Output

  • Format:image
  • Location: project -> ./output/, one-time -> $VISUAL/output/image-transform/

baseline Task ID

see references/task-id-baseline.md corresponding row.