Skip to content

Image Translator: OCR-based tool for translating text within images using Google Translate. Effortlessly extract, translate, and overlay text onto images.

Notifications You must be signed in to change notification settings

boysugi20/python-image-translator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Translator

This project utilizes optical character recognition (OCR) and translation to translate text within images from one language to another. It performs the following steps:

  1. OCR Processing: The project extracts text and its bounding boxes from input images using the EasyOCR library.
  2. Translation: It translates the extracted text using the Google Translator API.
  3. Text Replacement: The translated text is then overlaid onto the image, replacing the original text while maintaining its position and style.
  4. Output: Finally, the modified image with translated text is saved to an output folder.

Setup

Installation

  1. Clone this repository to your local machine.
  2. Install the required Python dependencies using pip install pipenv && pipenv install.

Usage

  1. Place your input images in the input folder.
  2. Run the script main.py.
  3. Translated images will be saved in the output folder.

Notes

  • Supported languages for OCR can be seen here
  • Supported languages for Google Translate can be obtained using the following code:
    from deep_translator.constants import GOOGLE_LANGUAGES_TO_CODES
    print(GOOGLE_LANGUAGES_TO_CODES)
  • Adjustments to text languages, recognition thresholds, translation services, or image processing parameters can be made within the script.

Examples

image-1 image-1-translated

Acknowledgments

About

Image Translator: OCR-based tool for translating text within images using Google Translate. Effortlessly extract, translate, and overlay text onto images.

Resources

Stars

Watchers

Forks

Languages