Google offers API services like text recognition and translation on its Google Cloud Platform. They can be used in ImageTrans to translate images. In this article, we are going to talk about how to set it up to use Google’s OCR and machine translation services in ImageTrans.

Prerequisite

You need to create a Google Cloud Platform account first. You can get a $300 credits for the first year. With this amount, you can make OCR requests for 212,000 times.

New Project

Create a new project first.

New project

Enable Cloud Vision OCR

Go to API&Services, search “OCR” and enable it.

api services sidemenu

cloud vision search

New API Key

Create a new API key.

new api key

Fill it in ImageTrans’s preferences.

api preferences

Then we can select Google as the OCR engine to use it.

ocr combobox

Enable Cloud Translation

Similarly, we can enable cloud translation.

cloud translate search

OCR and machine translation can share the same API key. After enabling it, we can use Google to translate texts.

cloud translate

Enable OCR via Google Drive

We can upload an image file to Google Drive and get its text. Compared to the Vision OCR API, this is completely free.

Enable the Drive API

Go to API&Services, search “Drive” and enable it.

Google Drive Search

Enable OAuth

Enable OAuth so that we can login our gmail account.

  1. New OAuth screen. Choose External.

    oauth

  2. Fill in required info and add your gmail account as the test account.

    add test user

  3. Create a new OAuth client id. Select desktop application.

    new credentials

    new oauth client

  4. Download the JSON file, renamed it as credentials.json and put it under ImageTrans’s foler.

Install the Plugin for ImageTrans

  1. Download the jar file and put it in ImageTrans’s folder: google_drive_ocr_commandline.jar. Rename it as google_drive_ocr.jar.
  2. Download the plugin zip and unzip it in the plugins folder: google_drive.zip
  3. Select Google Drive as the OCR engine.

    ocr combobox google drive

You can learn more about Google Drive OCR here.

Gemini

The latest AI LLM model by Google, Gemini, can also be used for machine translation.

Check out this issue to learn about how to use it.