# Image Translator

> Translate Chinese text in images to English while preserving 100% of visual elements. Uses Claude for OCR + translation, Gemini for image editing. Outputs 4K images. Use when: User mentions translating images, image translation, Chinese to English, translate screenshot, translate diagram, translate UI, architecture diagram translation

- Skill: `mr-shaper/image-translator` (Agent Skill, multi-file: 6 files)
- Install (CLI): `npx skillmds@latest add mr-shaper/image-translator`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mr-shaper/image-translator/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: mr-shaper (https://skillmd.com/u/mr-shaper)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/mr-shaper/image-translator

---


# 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

```bash
pip install gemimg openai anthropic
```

## Configuration

```bash
# 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

```bash
# 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 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
```

