Overview
Perform text content replacement on an existing image: simple precise text replacement (all four conditions satisfied: standard print font/single location/≤6 characters/character count unchanged) and complex text replacement (stylized text/handwriting/stylized/multiple locations/character count changes).
API Mapping
- Simple precise text replacement: simple text replacement path.
- Complex text replacement: prioritize
praline_pro, and on failure degrade in order topraline_lite、mint_edit。
Dependencies
- meitu-cli:
>=2.0.6 - credentials:CONFIG AKSK →
meitu tools update; EXEC AKSK → actual execution (see rootCONFIG.md) - environment variables:
MEITU_OPENAPI_TOOL_TASK_MODE=command
Path aliases:
$VISUAL={OPENCLAW_HOME}/workspace/visual/
Core Workflow
Preflight → Execute → Deliver
Preflight
meitu --version≥ 2.0.6- Already ran with CONFIG AKSK
meitu tools update - current AKSK = EXEC,
MEITU_OPENAPI_TOOL_TASK_MODE=command - output_dir:openclaw.yaml →
./output/|else →$VISUAL/output/image-text-replace/;mkdir -p
Execute
Trigger signals / routing rules
Core dimensions:four-condition check(must all be satisfied simultaneously):
- Font type: standard print font (Songti/Heiti/Kaiti/Rounded/Serif/Sans-serif/Monospace)
- Edit location: modify only one place of text
- Character length: the number of characters in the modified text ≤ 6
- Character count identity: original character count = modified character count
| Scenario | Judgment | Route |
|---|---|---|
| All four conditions satisfied | Standard print font + single location + ≤6 characters + character count unchanged | Simple text replacement path → praline_pro → praline_lite → mint_edit |
| Stylized text / handwriting / stylized | Decorative lettering, handwriting, stylized | praline_pro → praline_lite → mint_edit |
| Multiple edits | Change multiple places | praline_pro → praline_lite → mint_edit |
| Character count >6 or character count changes | Long text / 3 characters→5 characters | praline_pro → praline_lite → mint_edit |
Parameter definitions
| Parameter | Type | Required | Description |
|---|---|---|---|
image_url |
STRING | Yes | Image address. If missing → prompt "Please provide the image that needs text replacement" |
source_words |
STRING | Conditionally required | Original text content. Required for simple text replacement; for complex text replacement it can be automatically extracted from prompt automatically extracted |
target_words |
STRING | Conditionally required | Target text content. Required for simple text replacement |
prompt |
STRING | No | Text replacement description; for complex text replacement, automatically generate an English text replacement instruction based on source_words / target_words automatically generate an English text replacement instruction |
The simple text replacement path directly passes image_url、source_words and target_words; complex text replacement uses praline_pro、praline_lite or mint_edit, and constructs an English text replacement instruction based on source_words/target_words .
When the target text contains Chinese,prompt the target text inremains as-is and is not translated。
Tool invocation
meitu image-text-replace --image_url <url> --source_words "<原文>" --target_words "<新文>" --json --download-dir {output_dir} --skill_name skill_image-text-replace
Error degradation
| Scenario | Handling method |
|---|---|
image_url missing |
Prompt "Please provide the image that needs text replacement" |
image_url inaccessible |
Directly return an invalid image link error, do not retry |
source_words / target_words missing |
Prompt "Please tell me which text to change to what" |
source_words not found in the image |
Return the original image and inform that no matching text was found |
| Character count change / styled text / multiple places | Do not use simple text replacement; directly use praline_pro |
| Simple text replacement path call failed | Automatically upgrade to praline_pro |
praline_pro call failed |
Automatically downgrade to praline_lite |
praline_lite call failed |
Automatically downgrade to mint_edit |
mint_edit call failed |
Return error |
| User wants to edit multiple images at once | Prompt to process one image at a time |
| User did not provide font information | Judge as standard print font, try simple API first; automatically upgrade on failure |
| Content compliance interception | Directly return compliance prompt, no retry, no downgrade |
Deliver
- Use output_dir parsed by Preflight
- From
downloaded_files[0].saved_pathread the downloaded file path mv {downloaded_files[0].saved_path} {output_dir}/{YYYY-MM-DD}_{descriptive}_image-text-replace.{ext}
Output
- Format:image
- Position: project →
./output/, one-time →$VISUAL/output/image-text-replace/
Baseline Task ID
See references/task-id-baseline.md corresponding line in.