CamScanner Translate Image

v1.0.0

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 l...

0· 36· 1 versions· 0 current· 0 all-time· Updated 15h ago· MIT-0

Install

openclaw skills install 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

Version tags

latestvk971f1gc3bkkyatffm37zx8sr185vj5t

Runtime requirements

🌐 Clawdis
Binscurl, jq