Scanning image using Epson Scanner on Raspberry Pi

Vivek Maskara
2 min readSep 10, 2022
Photo by Harrison Broadbent on Unsplash

Learn how to scan images using Epson Scanner with a Python Script

In this post, we will learn how to use Epson Scanner’s Linux utility to scan images using a Python script.

Let us jump right into it and learn how it can be done.

Setup scanner utility

First, we need to set up the Epson scanner utility on the Raspberry Pi.

Step 1: Download the utility tar

Download the tar file from this location. You can also run the following command in the terminal to download the tar.

wget https://download2.ebz.epson.net/epsonscan2/common/deb/arm/epsonscan2-bundle-raspbian-6.6.40.0.armv7l.deb.tar.gz

Step 2: Unzip the tar

Next, unzip the downloaded tar.

tar -tvf epsonscan2-bundle-raspbian-6.6.40.0.armv7l.deb.tar.gz

Step 3: Install the scanner utility

Locate the install.sh file and run the script to install the scanner utility.

./install.sh

Now, that we have the scanner utility setup, we can go ahead and use it to scan images. First, let us learn about some of the key scanner commands.

Epson scanner commands

Checking connected scanners

We can fetch a list of connected scanners to the Raspberry Pi using the following command.

epsonscan2 --list

Checking scanner status

We can check the status of the connected scanner using the following command.

epsonscan2 --get-status

Scanning image

We can scan images using the following command.

epsonscan2 --scan scan_settings.sf2

Notice, that the command takes a config file as input. You can check out the config file here.

Scanning images using python script

Finally, let us learn how to scan images using the Epson scanner’s utility using a python script.

Step 1: Add the scan settings

Create a file named scan_settings.sf2for the scan settings and add the following contents to it.

Notice that we have set the FileNamePrefix as img2 which will result in the image being saved at /home/<username>/img2.jpg .

You can tweak any of the other settings based on your use case.

Step 2: Write a python script for scanning images

Next, create a main.py file and add the following code snippet to it for scanning images.

That’s it. Once you run the python script, it should trigger a scan on the connected scanner. Once the scan completes, a new image will be generated at /home/<username>/img2.jpg .

That’s it for this post. Please leave a clap if you found this article useful. Consider subscribing to Medium to read more of my stories.

--

--