Skip to content

AadhityaS-2124/Multi_Lingua_Snap

Repository files navigation

🌍 Gemini Image Translator

Python 3.7+ License Gemini AI

Extract text from images and translate it to any language using Google's advanced Gemini 1.5 Pro model. This tool maintains original formatting, preserves special characters, and provides both GUI and CLI interfaces for maximum flexibility.

Table of Contents

Features

  • πŸ€– Advanced Text Extraction using Gemini 1.5 Pro AI model
  • 🎨 Format Preservation - Maintains original text formatting and structure
  • πŸ”€ Special Character Support - Preserves special characters, numbers, and symbols
  • πŸ’» Dual Interface - User-friendly GUI and powerful command-line interface
  • 🌐 Multi-Language Support - Translate to 100+ languages
  • πŸ‘οΈ Real-time Preview - See your image before processing
  • ⏱️ Progress Tracking - Monitor translation progress
  • πŸ“Š High Accuracy - Enhanced accuracy for both text extraction and translation

Prerequisites

  • Python 3.7 or higher
  • Google API Key for Gemini models (free tier available)
  • Internet connection for API access

Installation

1. Clone the Repository

git clone https://github.com/AadhityaS-2124/Multi_Lingua_Snap.git
cd Multi_Lingua_Snap

2. Install Dependencies

pip install -r requirements.txt

3. Get Your Google API Key

  1. Visit Google AI Studio
  2. Click "Get API Key"
  3. Create a new API key or use an existing one
  4. Copy the API key

Configuration

Set Up Environment Variable

Option 1: Environment Variable (Recommended for Security)

# On Windows
set GOOGLE_API_KEY=your_api_key_here

# On Linux/Mac
export GOOGLE_API_KEY=your_api_key_here

Option 2: Permanent Environment Variable

  • Windows: Search "Environment Variables" β†’ Add to System Variables
  • Mac/Linux: Add to ~/.bashrc, ~/.zshrc, or ~/.profile:
    export GOOGLE_API_KEY=your_api_key_here

Option 3: Direct Configuration (Not Recommended)

You can modify the script to include your API key directly, but never commit this to shared repositories.

⚠️ Security Warning: Never hardcode your API key in the repository or commit it to version control. Always use environment variables.

Usage

GUI Interface (Recommended for Beginners)

Run the graphical interface for an intuitive, easy-to-use experience:

python image_translator_gui.py

Features:

  • Browse and select image files
  • Real-time image preview
  • Dropdown menu for language selection
  • Progress indicator
  • Copy translated text to clipboard

Command Line Interface (CLI)

For automation and scripting:

python gemini_image_translator.py --image path/to/your/image.jpg --language "Spanish"

CLI Parameters

Parameter Description Example
--image Path to the image file containing text sample_image.jpg
--language Target language for translation "Spanish", "French", "Japanese"

CLI Examples

# Translate to Spanish
python gemini_image_translator.py --image document.jpg --language "Spanish"

# Translate to French
python gemini_image_translator.py --image receipt.png --language "French"

# Translate to Japanese
python gemini_image_translator.py --image menu.jpg --language "Japanese"

Supported Languages

The tool supports 100+ languages including:

  • European: English, Spanish, French, German, Italian, Portuguese, Dutch, Polish, Swedish, Greek, Russian
  • Asian: Chinese (Simplified & Traditional), Japanese, Korean, Hindi, Thai, Vietnamese, Indonesian, Tagalog
  • Middle Eastern: Arabic, Hebrew, Farsi, Turkish
  • And many more!

For a complete list, refer to Google's Supported Languages.

Project Structure

Multi_Lingua_Snap/
β”œβ”€β”€ gemini_image_translator.py    # CLI tool for image translation
β”œβ”€β”€ image_translator_gui.py        # GUI application
β”œβ”€β”€ requirements.txt               # Python dependencies
β”œβ”€β”€ README.md                      # This file
└── sample_image.jpg              # (Optional) Example image for testing

Output

The tool outputs:

  1. Original Text - Text as extracted from the image
  2. Translated Text - Translated content in your target language

Example Output

=== Original Text ===
Hello, this is a sample document.

=== Translated Text (Spanish) ===
Hola, este es un documento de ejemplo.

Troubleshooting

Common Issues and Solutions

Issue Solution
API key not found Ensure GOOGLE_API_KEY environment variable is set. Restart your terminal after setting it.
Invalid image format Supported formats: JPG, PNG, GIF, WebP. Ensure your image is in one of these formats.
No text found in image Image may be too blurry or have low contrast. Try a clearer image with better lighting.
API quota exceeded You've reached your daily API limit. Wait 24 hours or upgrade your API tier.
Module not found error Run pip install -r requirements.txt to install all dependencies.
Permission denied Ensure the image file is readable and you have access to it.

Debug Mode

For more detailed error messages, you can modify the scripts to enable debug logging:

import logging
logging.basicConfig(level=logging.DEBUG)

Notes

  • Image Quality: The accuracy of text extraction depends heavily on image clarity
  • Best Practices: Use clear images with good contrast between text and background
  • Performance: Processing time depends on image size and API response time
  • Formatting: Original text formatting, special characters, and numbers are preserved
  • API Costs: Check Google's Gemini API pricing for free tier limits and rates
  • Batch Processing: For multiple images, consider scripting with a loop

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please ensure your code follows PEP 8 standards and includes appropriate comments.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Support

For issues, questions, or suggestions:

  • Open an Issue
  • Check existing discussions for similar questions

Last Updated: 2026
Maintainer: AadhityaS-2124

About

Extract text from images and translate it to 100+ languages using Google's advanced Gemini 1.5 Pro AI model. Multi_Lingua_Snap offers both GUI and command-line interfaces for seamless image translation while maintaining original formatting and special characters. Perfect for document translation, travel, and multilingual content processing.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages