SuperAPI AI Directory

image-translator

Design & creation

View repository

Updated 10-16 01:28

About this skill

Image Text Translator

Translate Chinese text in images to English while preserving 100% of visual elements.

Architecture

┌─────────────────────────────────────────────────────┐
│  Step 1: Claude (Main AI)                           │
│  • OCR: Extract all Chinese text                    │
│  • Translate to professional English                │
│  • Generate Gemini editing instructions             │
└─────────────────────────────────────────────────────┘
                         │
                         ▼
┌─────────────────────────────────────────────────────┐
│  Step 2: Gemini (Executor)                          │
│  • Replace Chinese → English per instructions       │
│  • Strictly follow preservation rules               │
│  • Output 4K high-resolution image                  │
└─────────────────────────────────────────────────────┘

Installation

pip install gemimg openai anthropic

Configuration

# Claude API (choose one)
export ANTHROPIC_API_KEY="your-key"
# OR use OpenAI-compatible proxy
export OPENAI_API_KEY="your-key"
export OPENAI_BASE_URL="https://your-proxy.com/v1"

# Gemini API
export GEMINI_API_KEY="your-key"

# Optional: specify Claude model
export CLAUDE_MODEL="claude-sonnet-4-20250514"

Usage

Command Line

# Full workflow
python ~/.claude/skills/custom/image-translator/scripts/translate.py input.png

# Specify output
python ~/.claude/skills/custom/image-translator/scripts/translate.py input.png -o output.png

# Use existing analysis JSON (skip Claude OCR)
python ~/.claude/skills/custom/image-translator/scripts/translate.py input.png -j analysis.json

# Generate prompt only (for manual Gemini website usage - better quality)
python ~/.claude/skills/custom/image-translator/scripts/translate.py input.png --prompt-only

In Claude Code

Just tell Claude:

  • "Translate this image"
  • "Translate this image into English."
  • "Translate this architecture diagram to English"

Output Files

  1. {filename}_en.png - Translated 4K image
  2. {filename}_analysis.json - Claude analysis with translation mapping
  3. {filename}_prompt.txt - Complete Gemini prompt (text rules + JSON)

Preservation Rules

Gemini strictly follows these rules:

  1. Text replacement only - Chinese → English
  2. 100% preserve visual elements:
    • Layout & positioning: pixel-perfect
    • Colors & gradients: exact same
    • Font sizes & styles: match original
    • Icons & graphics: untouched
    • Borders & lines: unchanged
    • Background: identical
  3. Text styling:
    • Position: centered in original bounding box
    • Size: fit same space
    • Color: exact same as original Chinese
  4. Quality:
    • Resolution: 4K
    • No blur, artifacts, or watermarks

Cost Reference

  • Claude (OCR + Translation): ~$0.01-0.05/image
  • Gemini (4K editing): ~$0.02-0.05/image
  • Total: ~$0.03-0.10/image

Workflow

User provides image
    │
    ▼
Claude analyzes image
    ├── OCR: extract all Chinese
    ├── Translate to English
    └── Generate JSON + Gemini instructions
    │
    ▼
Save analysis.json + prompt.txt
    │
    ▼
Gemini executes image editing
    ├── Read Claude instructions
    ├── Replace Chinese → English
    └── Output 4K image
    │
    ▼
Return translated image