Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Translate text on images to a target language using SurgePix API, keeping the background unchanged. Use when the user says "translate image", "图片翻译", "翻译图片", "translate text on image", "把图片翻译成英文/中文", or wants to localize image text. Language: always pass --language for target on-image text; infer from user request (English user without target → en, 中文 → zh). Output rule: ZIP when multiple images — show ONLY download URL.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | 103% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 82% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 979% | 0% |
| case-20 | ✗→✓ | ▲ Improved | 109% | 0% |
| case-22 | ✗→✓ | ▲ Improved | 142% | 0% |
Translate text on one or more images to a target language while preserving the background, using the platform API. Use when the user asks to translate image text, localize a poster/screenshot, or convert on-image copy to another language.
--language is the target language for on-image text, not the agent's reply language.
| Priority | Rule | |----------|------| | 1 | User explicitly names a target (e.g. "translate to English", "翻译成日文") → use that language code | | 2 | User does not specify target → infer from intent: English request → --language en; 中文请求 → --language zh; 日本語 → --language ja | | 3 | Ambiguous → ask the user which target language they want |
--language — do not rely on the script default (en) without checking user intent.--language target).| Action | Description | |---------------------|-----------------------------------------------------------------------------| | Translate image | Pass local file(s) or URL(s); script uploads and translates in one step | | Batch translate | Pass multiple images in one call; result is a ZIP download URL | | Check task status | When run with --nowait true, poll by taskId via surgepix-query-task | | Download result | Single image → image URL; multiple images → ZIP URL |
> By default (--nowait false), the API waits for completion and returns the final download URL in one call. With --nowait true, the API returns a taskId immediately; resolve it later with the surgepix-query-task skill.
Requirement: Set the SURGEPIX_API_KEY environment variable. Get your API Key at your platform's API management page.
bashexport SURGEPIX_API_KEY=your-api-key-here
This skill uses the script at <skills-dir>/surgepix-image-translate/scripts/image_translate.mjs.
First run — translate a local image to English (default):
bashnode "<skills-dir>/surgepix-image-translate/scripts/image_translate.mjs" \ ./poster.png # Output (JSON): # {"ok":true,"taskId":"task_abc123","sessionId":123,"progress":"succeeded","download":"https://...","imageCount":1,"resultType":"image"} # ← Save sessionId for retries
Translate to Chinese:
bashnode "<skills-dir>/surgepix-image-translate/scripts/image_translate.mjs" \ ./poster.png \ --language zh
Retry / iterate with same session:
bashnode "<skills-dir>/surgepix-image-translate/scripts/image_translate.mjs" \ ./poster.png \ --language en \ --session-id 123
Multiple images (returns ZIP):
bashnode "<skills-dir>/surgepix-image-translate/scripts/image_translate.mjs" \ ./page1.png ./page2.png \ --language en # download → ZIP URL; resultType=zip
Async submit (return taskId only):
bashnode "<skills-dir>/surgepix-image-translate/scripts/image_translate.mjs" \ ./poster.png \ --language ja \ --nowait true # Returns JSON immediately: # {"ok":true,"async":true,"taskId":"task_abc123",...,"hint":"..."} # Then use surgepix-query-task to check status
Before first use, run the environment check:
bashnode "<skills-dir>/surgepix-setup/scripts/check_env.mjs"
.env, then retryen../poster.png)en, zh, ja, etc. Always pass based on user intent (see Language consistency).sessionId from the last run. Omit on first run — the platform auto-creates a new session.JPEG, JPG, PNG, WEBPbashnode "<skills-dir>/surgepix-image-translate/scripts/image_translate.mjs" \ "<file path or URL>" [<image2> ...] \ [--language <code>] \ [--session-id <sessionId>] \ [--nowait <true|false>]
--file prefix. The script uploads local files automatically.--nowait false): API waits for completion and returns the final download URL.--nowait true to return the taskId immediately; resolve later with surgepix-query-task.Sync success (--nowait false, stdout):
json{"ok":true,"taskId":"task_abc123","sessionId":123,"progress":"succeeded","download":"https://...","imageCount":1,"resultType":"image"}
Async submitted (--nowait true, stdout):
json{"ok":true,"async":true,"taskId":"task_abc123","sessionId":123,"progress":"processing","download":null,"imageCount":1,"resultType":"image","hint":"..."}
Failure (stderr):
json{"ok":false,"error":"..."}
download URL.resultType: "image" — single translated imageresultType: "zip" — multiple images packaged as ZIPsessionId (number type, e.g. 123) so the user can retry in the same session.error field. Common causes:unsupported_image_format — file format not supportedimage_too_large — file exceeds 20MB--session-id 123 — both attempts appear in the same session history.| Parameter | Required | Default | Description | |--------------------------|----------|--------------|-----------------------------------------------------------------------------| | <file path or URL> | Yes | — | Positional argument(s). One or more local paths or image URLs | | --language <code> | Yes | user intent | Target language for on-image text, e.g. `en`, `zh`, `ja`. Always pass — match explicit request or user's language | | `--session-id <id>` | No | auto-created | Omit on first run; provide on retries to group iterations in one session | | `--nowait <true\|false>` | No | `false` | `false` = sync: API waits and returns final `download`. `true` = async: returns `taskId`; resolve via surgepix-query-task |
download is an image URL; multiple images → download is a ZIP URL.JPEG, JPG, PNG, WEBP. Max file size: 20MB per image.sessionId from output (number type). Pass --session-id 123 on retry to keep iterations in one session.--file prefix.check_env.mjs before first use in each session.download value from output.Other measured skills in the registry, with their headline benchmark lift.