camscanner-translate-image

Use CamScanner to translate text in images to another language while preserving the original layout. Detects text in the image, translates it to the target language, and renders the translated text back onto the image. Use when the user wants to translate text in an image, photo, screenshot, or scanned document to another language. Triggers on "translate image", "translate text in image", "image translation", "translate this to English/Japanese/Korean/etc.", or when the user has an image with foreign text and wants it translated.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "camscanner-translate-image" with this command: npx skills add CamScanner/camscanner-translate-image

CamScanner Translate Image

Overview

CamScanner provides image translation: detect text in images, translate to the target language, and render translated text preserving the original layout. The workflow is a 3-step pipeline: upload the image, translate it, then download the result.

When to Use

  • User wants to translate text in an image to another language
  • User has a photo, screenshot, or scanned document with foreign text
  • User wants to understand text in an image that is in a different language

Privacy & Data

Important: Privacy & Data Flow Notice

  • Third-party service: This skill sends your files to CamScanner's official servers (ai-tools.camscanner.com) for processing.
  • Data retention: CamScanner servers process your files in real-time. Files are not permanently stored on the server.
  • Local files: Output files are saved to your local filesystem at the path you specify.

API Reference

Base URL: https://ai-tools.camscanner.com

Target Language (to parameter)

The to parameter specifies the target language code. Determine it from the user's intent.

Common language mapping (use this first):

User says (English)User says (Chinese)to code
English英语/英文en
Chinese Simplified简体中文/中文zh-Hans
Chinese Traditional繁体中文zh-Hant
Cantonese粤语yue
Japanese日语/日文ja
Korean韩语/韩文ko
French法语/法文fr
German德语/德文de
Spanish西班牙语es
Portuguese葡萄牙语pt
Russian俄语/俄文ru
Arabic阿拉伯语ar
Italian意大利语it
Dutch荷兰语nl
Thai泰语/泰文th
Vietnamese越南语vi
Indonesian印尼语id
Malay马来语ms
Turkish土耳其语tr
Polish波兰语pl
Swedish瑞典语sv
Danish丹麦语da
Hindi印地语hi
Bengali/Bangla孟加拉语bn
Ukrainian乌克兰语uk
Czech捷克语cs
Greek希腊语el
Hebrew希伯来语he
Finnish芬兰语fi
Hungarian匈牙利语hu

If the target language is NOT in the table above, look up the language code dynamically:

LANG_DATA=$(curl -sS "https://open.camscanner.com/sync/get_languages")
# Parse LANG_DATA to find the matching language code by name or chineseName
# Example: find code for "Romanian"
TO=$(echo "$LANG_DATA" | jq -r '.data | to_entries[] | select(.value.name == "Romanian" or .value.chineseName == "罗马尼亚语") | .key')

The API returns all supported languages with name (English), nativeName, and chineseName (Chinese) fields.

Step 1: Upload Image

BASE="https://ai-tools.camscanner.com"

IN_FILE_ID=$(curl -sS -X POST "$BASE/v1/tools/upload_file/execute" \
  -H "Content-Type: application/octet-stream" \
  --data-binary "@/path/to/image.png" | jq -r '.tool_result.data.file_id')

Response:

{
  "code": 200,
  "tool": "upload_file",
  "tool_result": {
    "success": true,
    "data": {
      "file_id": "file_1741857600_ab12cd34ef56",
      "size": 24576
    }
  }
}

Step 2: Translate Image

OUT_FILE_ID=$(curl -sS -X POST "$BASE/v1/tools/translate_image/execute" \
  -H "Content-Type: application/json" \
  -d "{\"file_id\":\"$IN_FILE_ID\",\"to\":\"$TO\"}" \
  | jq -r '.tool_result.data.file_id')

Replace $TO with the target language code (e.g., en, ja, zh-Hans).

Response:

{
  "code": 200,
  "tool": "translate_image",
  "tool_result": {
    "success": true,
    "data": {
      "file_id": "file_1741857701_9988aabbccdd",
      "target_type": ""
    },
    "metadata": {
      "engine": "imagetranslate"
    }
  }
}

Step 3: Download Result

curl -sS -X POST "$BASE/v1/tools/download_file/execute?response_mode=raw" \
  -H "Content-Type: application/json" \
  -d "{\"file_id\":\"$OUT_FILE_ID\"}" \
  -o /path/to/translated.png

Critical: The response_mode=raw query parameter is required to get the binary file. Without it, the response is JSON.

Quick Reference: Complete Pipeline

BASE="https://ai-tools.camscanner.com"
INPUT_IMAGE="/path/to/image.png"
OUTPUT_FILE="/path/to/translated.png"
TO="en"   # target language code — see mapping table above

# Upload
IN_FILE_ID=$(curl -sS -X POST "$BASE/v1/tools/upload_file/execute" \
  -H "Content-Type: application/octet-stream" \
  --data-binary "@$INPUT_IMAGE" | jq -r '.tool_result.data.file_id')

# Translate
OUT_FILE_ID=$(curl -sS -X POST "$BASE/v1/tools/translate_image/execute" \
  -H "Content-Type: application/json" \
  -d "{\"file_id\":\"$IN_FILE_ID\",\"to\":\"$TO\"}" \
  | jq -r '.tool_result.data.file_id')

# Download
curl -sS -X POST "$BASE/v1/tools/download_file/execute?response_mode=raw" \
  -H "Content-Type: application/json" \
  -d "{\"file_id\":\"$OUT_FILE_ID\"}" \
  -o "$OUTPUT_FILE"

Language Code Lookup (for uncommon languages)

If the user requests a language not in the common mapping table, look it up dynamically:

TARGET_LANG="Romanian"   # or Chinese name like "罗马尼亚语"

LANG_DATA=$(curl -sS "https://open.camscanner.com/sync/get_languages")
TO=$(echo "$LANG_DATA" | jq -r --arg lang "$TARGET_LANG" \
  '.data | to_entries[] | select(.value.name == $lang or .value.chineseName == $lang or .value.nativeName == $lang) | .key')

if [ -z "$TO" ] || [ "$TO" = "null" ]; then
  echo "Unsupported language: $TARGET_LANG"; exit 1
fi

Common Mistakes

MistakeFix
Forgetting response_mode=raw on downloadAlways append ?response_mode=raw to the download URL
Wrong Content-Type on uploadUpload uses application/octet-stream, not multipart/form-data
Using GET instead of POSTAll three endpoints use POST
Missing to parameterAlways include target language code in the translate request
Wrong language codeUse codes from the mapping table; for uncommon languages, use the lookup API
Using "zh" instead of "zh-Hans"Chinese Simplified is zh-Hans, not zh; Traditional is zh-Hant

Error Handling

Check each step before proceeding:

# After upload
if [ -z "$IN_FILE_ID" ] || [ "$IN_FILE_ID" = "null" ]; then
  echo "Upload failed"; exit 1
fi

# After translate
if [ -z "$OUT_FILE_ID" ] || [ "$OUT_FILE_ID" = "null" ]; then
  echo "Translation failed"; exit 1
fi

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

AIWolfPK - AI狼人杀

四个AI互相猜疑,你坐着看戏。每局30秒,到底谁是狼? Four AIs play Werewolf while you watch. 30s per round. Spot the wolf before they do.

Registry SourceRecently Updated
General

Project Analyzer

Analyze any project directory and produce a detailed report covering what the project does, its tech stack, folder structure, entry points, how to run it, an...

Registry SourceRecently Updated
General

Thought-Retriever

提炼对话回答中的核心洞察为高置信度知识晶体,存储于本体驱动记忆系统的自我进化与复用。

Registry SourceRecently Updated
General

Miaoji Bid Guard Pro

亚马逊广告护城河Pro版,90天ROI预测+多活动协同+季节性出价+关键词攻防矩阵。 从单次调价建议升级为完整的广告战役规划。基础功能可使用 miaoji-bid-guard 免费版。

Registry SourceRecently Updated