Providing a seamless experience where anyone can intuitively translate Japanese text within images to English and save the result as an image while preserving the original layout.
Image Japanese Translator is a professional-grade web application that automatically detects and translates Japanese text found in images, manga, or screenshots using Google Gemini AI models. It seamlessly composites the translated English text back onto the original layout, allowing users to adjust position, size, and export quality with zero design skills required.
Note: This project is built for high-accuracy translation and layout preservation, specifically optimized for Japanese-to-English manga and technical document translation.
- ๐ Zero-Config OCR & Translation: Leverages Google Gemini 2.0 Flash for ultra-fast, context-aware translation.
- ๐จ Interactive Canvas Editor: Intuitive drag-and-drop movement and corner-handle resizing of translated text blocks.
- ๐ Smart Layout Preservation: AI-assisted background color estimation ensures translated text blends naturally with the original image.
- ๐ Pro-Grade Export: Presets for 4K, HD, and SNS (Twitter/X, etc.), with adjustable JPEG/PNG quality from 10% to 100%.
- โ๏ธ Unit Converter: Specialized tool for converting units found in technical diagrams (cm to inch, km to mile, etc.).
- ๐ Privacy First: Client-side processing ensures your images are only sent to Google Gemini and are never stored on our servers.
- Frontend: Next.js 15.1.12 (App Router)
- UI Logic: React 19
- Styling: Tailwind CSS v4
- AI Engine: Google Gemini API (
@google/genai) - Language: TypeScript
- Deployment: Vercel (Recommended)
- Node.js: 20.x or higher (LTS recommended)
- Package Manager:
npm(v10+) orpnpm - API Key: A valid Google Gemini API Key
git clone https://github.com/stewroux/image_translation_tool.git
cd image_translation_toolnpm installCreate a .env.local file in the root directory:
# Required for translation features
NEXT_PUBLIC_GEMINI_API_KEY=your_actual_api_key_herenpm run devOpen http://localhost:3000 in your browser.
โโโ app/
โ โโโ globals.css # Global design tokens and Tailwind imports
โ โโโ layout.tsx # Root layout with Google Fonts (Inter, Roboto)
โ โโโ page.tsx # Main application state and orchestration logic
โโโ components/
โ โโโ ImageUploader.tsx # Optimized drag & drop zone with next/image preview
โ โโโ ExportSettings.tsx # Precision control panel for output dimensions/quality
โ โโโ ProgressBar.tsx # Multi-stage visual feedback for AI processing
โ โโโ ResultDisplay.tsx # High-performance HTML5 Canvas interaction layer
โ โโโ SettingsModal.tsx # In-browser API key management (via LocalStorage)
โโโ services/
โ โโโ geminiService.ts # Advanced Prompt Engineering for Gemini structured OCR
โโโ utils/
โ โโโ unitConverter.ts # Regex-based measurement unit detection and conversion
โโโ public/ # Static assets and icons
- Upload: User drops a file (up to 10MB) into
ImageUploader. - Analysis: Client encodes image to Base64 and invokes
gemini-2.0-flash. - Structured OCR: AI returns a JSON array containing:
boundingBox: Normalized coordinates (x, y, width, height).japaneseText: Original text detected.englishText: High-context translation.backgroundColor: Estimated dominant color behind the text.
- Interactive Render:
ResultDisplaydraws the image and overlays editable text blocks on the Canvas. - Modification: User manually refines position/size/units.
- Export: Canvas is re-rendered at the target resolution and downloaded as a blob.
Our development process follows a strict 3-phase cycle to ensure code quality and performance:
- Define scope (ๆฅ่ฑ็ฟป่จณใฎใฟ, account-less).
- Map out UX flow: Upload โ Translate โ Edit โ Export.
- Document in
่ฆไปถๅฎ็พฉๆธ.md.
- Integrate
@google/genai. - Implement Canvas-based interaction logic (Move/Resize).
- Establish the
geminiServiceprompt to ensure 100% JSON consistency.
- Security audits (e.g., upgrading to
next@15.1.12). - Performance optimization (replacing
<img>withnext/image). - UI/UX refinements (Gradients, Glassmorphism, Responsive design).
| Variable | Required | Description | Default |
|---|---|---|---|
NEXT_PUBLIC_GEMINI_API_KEY |
Yes* | Google Gemini API Key | - |
Note: If the environment variable is missing, the app will fallback to the key stored in
localStoragevia the UI Settings menu.
| Command | Action |
|---|---|
npm run dev |
Starts the development server at localhost:3000 |
npm run build |
Compiles the production build |
npm run start |
Runs the production-built application |
npm run lint |
Checks code for style and consistency issues |
Verification is currently performed via:
- Build Validation: Running
npm run buildto catch type errors and ESLint warnings. - Manual QA: Uploading standard manga/tech-doc samples to verify OCR accuracy and coordinate mapping.
- Connect this repo to Vercel.
- Set the
NEXT_PUBLIC_GEMINI_API_KEYin the project settings. - Deploy. The App Router architecture works out-of-the-box.
- Issue: Translation fails despite setting
.env.local. - Solution: The UI Settings (LocalStorage) takes precedence in some environments. Click the โ๏ธ icon and verify the key there.
- Issue: Slow dragging on 4K images.
- Solution: Resolution is downscaled for preview while maintaining original dimensions for the final export.
- Fork the project.
- Create your feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
- Developer: Ryoma Sato
- AI-Powered Development: This project was developed with the assistance of Google AI Studio and Google Antigravity.
- License: MIT License
