Scanning image using Epson Scanner on Raspberry Pi
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.
Step 2: Unzip the tar
Next, unzip the downloaded tar.
tar -tvf epsonscan2-bundle-raspbian-188.8.131.52.armv7l.deb.tar.gz
Step 3: Install the scanner utility
install.sh file and run the script to install the scanner utility.
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.
Checking scanner status
We can check the status of the connected scanner using the following command.
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
img2 which will result in the image being saved at
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
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.