Best Methods To Install and Run Tesseract OCR on Ubuntu 24.04

This guide intends to teach you to Install and Run Tesseract OCR on Ubuntu 24.04. Tesseract OCR (Optical Character Recognition) is an open-source OCR engine developed by HP and maintained by Google. It is used for recognizing and extracting text from images, and transforming printed or handwritten text into machine-readable text. Tesseract is highly powerful and supports various languages and text formats.

Easily Install and Run Tesseract OCR on Ubuntu 24.04

To Run Tesseract OCR on Ubuntu 24.04, you must log in to your server as a root or non-root user with sudo privileges. Then, follow the steps below and use one of the following methods to install Tesseract on Ubuntu 24.04:

  1. Using APT Repository
  2. Download and Install From Git

Method 1 – Installing Tesseract OCR on Ubuntu 24.04 with APT

The Tesseract package is available in the default Ubuntu 24.04 repository. To run Tesseract OCR on Ubuntu 24.04 with APT, run the system update and upgrade with the command below:

sudo apt update && sudo apt upgrade -y

Then, use the following command to install Tesseract on Ubuntu 24.04:

sudo apt install tesseract-ocr -y

Also, you can install the Imagemagic package on Ubuntu 24.04. ImageMagick is a powerful, open-source software that allows users to create, edit, compose, or convert bitmap images in various formats, such as JPEG, PNG, GIF, TIFF, and more. To install it, you can run the command below:

sudo apt install imagemagick -y

Once your installation is completed, you can verify it by checking its version:

tesseract --version

In your output, you should see something similar to this:

Run Tesseract OCR on Ubuntu 24.04 From Terminal

Method 2 – Installing Tesseract OCR on Ubuntu 24.04 From Git Source

Another method is downloading and installing Tesseract on Ubuntu 24.04 from the source. It provides the latest packages. To do this, you need to run the system update and upgrade with the command below:

sudo apt update && sudo apt upgrade -y

Then, install the required packages to run Tesseract OCR on Ubuntu 24.04 from the source:

sudo apt install automake ca-certificates g++ git libtool libleptonica-dev make pkg-config libpango1.0-dev -y

Next, use the following command to clone the Tesseract OCR from Git:

git clone https://github.com/tesseract-ocr/tesseract.git

Now navigate to your Tesseract directory and create the Tesseract installation files on Ubuntu 24.04 with the following commands:

# cd tesseract
# sudo ./autogen.sh

Then, you can compile, build, and install Tesseract OCR by using the following commands:

# sudo ./configure
# sudo make
# sudo make install

These may take some time to complete. Once it is finished, run the ldconfig command and compile the training tools:

# sudo ldconfig
# sudo make training

Next, install the training tools with the following command:

sudo make training-install

Once your installation is completed, you can verify it by checking its version:

cat VERSION

You should see the following output:

Installing Tesseract OCR on Ubuntu 24.04 From Git Source

How To Use Tesseract OCR on Ubuntu?

At this point, you can easily start using Tesseract OCR on Ubuntu 24.04.

To perform OCR on an image, you can use the following command:

tesseract image.png output
  • image.png: The input image file.
  • output: The name of the output file (without extension) where the recognized text will be saved.

With this command, Tesseract will create an output file (e.g., output.txt) containing the extracted text.

If your image contains text in a language other than English, specify the language using the -l option:

tesseract image.png output -l langcode

You can check the Tesseract Documentation Page to get more command line usage.

Conclusion

At this point, you have learned to Install and Run Tesseract OCR on Ubuntu 24.04. As you saw, you can easily use the APT repository to install it on your server, or you can download and get it from the source. After your installation is completed, you can start using it and perform an OCR on your images.

Hope you enjoy using it. Also, you may like to read the following articles:

Install Tesseract OCR on Debian 12 via Terminal

Install Tesseract OCR on AlmaLinux 9

Install and Use FFmpeg on Ubuntu 22.04

Work With FFmpeg on Linux

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!