This is a reprint of a previous article, by request. The information contained therein is probably out-dated by a few years. Therefore, I make no promise that the instructions below for setting up Epson scanning on Raspberry Pi is any way accurate.
This is the article that almost didn’t happen. I need my Epson all-in-one for scanning, and if I couldn’t get it working, then I was going to disconnect the Pi, reformat and repurpose (and I have other purposes for one, certainly). In fact, I had gotten printing working even over Airprint, so this was the last obstacle. I was prepared to disconnect it, but I decided to give it yet one more try, and I finally got some success.
Most Linux scanning is some pretty old stuff. It looks like it has been a long while since it’s been properly maintained. The SANE package is the core of all Linux scanning from what I can tell, but there are about as many broken links on the site as there are working ones. In fact, I keep getting a weird “Oops! Google Chrome could not connect to www.sane-project.org” when I try to access the homepage, so the whole project is somewhat questionable.
I assume it has a lot to do with wi-fi enabled all-in-one devices that will gladly connect to a network share and scan documents to it. However, it does point to a general problem with Linux in that too often applications are begun and abandoned before they become solid. While the networked printer-scanners might have something to do with it, the SANE-2.0 that should have standardized a lot of things never materialized.
The good news is that SANE is available on the Pi. The OK news is that Image Scan for the Epson is not available in binary form. The worse news is that the build does not create the graphical iscan utility. However, all is not lost! In fact, that wasn’t even the huge obstacle I ran into, as there are alternatives to the graphical front-end.
Build Iscan
So, you will have to make iscan from the source code. You will need some libraries:
sudo apt-get install xsltproc libgtk2.0-dev libxml2-dev
sudo apt-get install libsane-dev libltdl-dev
Download the latest Epson packages. Many have been outsourced to Seiko, but someone recently asked me about the V300, and it turns out that Epson has Linux drivers available for the V300 at their downloads site. So, it pays to check in both places.
You’ll at minimum need the data (installed first) and the core packages. Keep in mind that they only supply binaries for i386/AMD architectures and not for the Pi, so you’ll have to look for the appropriate build packages for your scanner.
Open terminal and change into data directory.Now, build using these commands:
./configure
make
sudo make install
Now change into core directory and do the same.
Install SANE and Configure
Make sure you have the latest SANE packages installed.
sudo apt-get install sane
To get vendor and product IDs, run the find scanner utility.
sane-find-scanner
List scanners recognized by SANE.
scanimage -L
If your scanner is not listed, which is likely, there is more work to do. Indeed, this was my major stumblingblock. I finally found the answer on the Raspberry Pi forum under topic “”.
First, if you haven’t already, be sure user saned is part of the lp group:
sudo adduser saned lp
Next, take the <vendor ID> and <product ID> you got from the find scanner utility and modify some files. In /etc/udev/rules.d/55-libsane.rules (create if it doesn’t exist):
SYSFS{idVendor}=="04b8", MODE="0666", GROUP="scanner", ENV{libsane_matched}="yes"
where: 04b8 is the Epson <vendor ID> without the initial “0x”. The find scanner utility gives us 0x04b8 for Epson, but the rules file only has 04b8 in it.
Now, there are two files in the /etc/sane.d: epson.conf and epson2.conf. I tried the first and then the second. I’m not sure what the rule is, but I suspect that it might be USB 1.0/1.1 vs USB 2.0. That’s a wild guess, though. So, in /etc/sane.d/epson2.conf, I changed the line that simply had “usb” alone in it to:
usb <vendor ID> <product ID>
Just to be inconsistent, those entries have the initial “0x”. So, mine is (for a CX7800):
usb 0x4b8 0x110
Now, reboot and test.
Testing Scanner
Scanning can result in some very large files, and your SD card will eventually run out of space and corrupt itself if you don’t take care with it. If you haven’t already, you really should create a mount point for a network share for the scanned files. In the following examples, I use /mnt/sambashare to put my files.
Find a photo or some document (preferably color for testing), and place it into the scanner. Make sure everything is on.
In order to scan in black and white, run:
scanimage --format=tiff > /mnt/sambashare/test.tiff
In order to scan in color, run:
scanimage --mode Color --resolution 300 --format=tiff > /mnt/sambashare/test.tiff
Almost There!
Like I said, when I built iscan, the iscan front-end did not build, only the back-end. So, now you just need a front-end. Granted, you could do it all from the commandline, but I really don’t recommend that. At least for me, it is difficult to visualize the outcome without the picture in front of me.
There are some “SANE – Frontends (Applications)” available on the one working page on the SANE site. Unfortunately, again, only half of the links work. Fortunately, there is one link that really does work.
I usually scan in PDFs, so gscan2pdf sounded perfect. In fact, I highly recommend it unless you need something particularly sophisticated. It is very Epson-like in some ways, although perhaps a little clunkier in that the control box is always in front of the image (at least it is if the application is maximized, which it likely will be under VNC).
sudo apt-get install gscan2pdf
It takes some playing around with, but at first I was thinking that I would have to have 2 programs because of the program’s name. However, after playing around with making some PDFs, I soon discovered it can also save to TIFF, PNG and JPEG as well.
The Cons
Of course, no setup is perfect, but at least this way I can offload my printing and scanning from another computer where I’d rather not have photos and personal information showing up on the screen. Since I might have to revert back to doing a screen scrape on that machine because Justin.TV is changing their formats (and avconv doesn’t seem inclined to play along), this is the next best thing.
“OK, so what’s the bad news?” you might be thinking. At the end of the day, the biggest hurdle is memory. Graphics take memory, and it appears that Gscan2pdf will allow you to queue up a lot of 600 dpi photos without warning you it cannot save them. It helps to keep in mind that your Pi only comes with 512MB (less if it is Model A), so this is not for large operations.
Having said that, I did scan in some legal documents (which seem to take a tree for each) into a PDF without difficulty. Of course, it wasn’t 600 dpi, either. However, the reason I bring it up is that this worked better than the standard Epson program running under Windows! For some reason, if I get in a big hurry and scan in more than 4 pages at a run without allowing a cooling period between, the EPSON Scan program craps out and makes me turn off the scanner and start it back up again. Under some circumstances, I actually wind up rebooting the entire computer to clear whatever it thinks is wrong. So, while the next con is a consideration, it is actually faster for me to do it this way than the way I was doing it.
That is, the second biggest problem is that it is slow. I understand that scanning, particularly at 600 dpi, is not fast by any means. However, even saving files is often best done by naming the file, clicking the right buttons and then go and catch up on email. More than once, some time had passed, and I wasn’t paying attention, so when I clicked on the close control I was informed that the file hasn’t been saved yet. When I look, the blue bar is still going along the bottom.
However, if you have documents or photos that are a consistent size, you could speed things up a lot using the commandline utility. The speed for me is only frustrating because I have suddenly found myself with a lot of stuff to go through and scan. And, I should add, all different sizes.
Yet, the constant lockup issues under Windows still makes this an attractive proposition even for speed. YMMV.
Another thing that might be an issue for some is that there doesn’t seem to be a good way to select only part of the scan to save or to only scan a specific region. Yeah, I know that there’s a tab for “Geometry”, but really? Here is where it falls short in comparison to the EPSON Scan utility, as that is as simple as select (with the mouse, even) and scan. I dunno; am I missing something?
Having said that, I usually scan in images and then edit them anyhow. That’s because it is easier to get good quality scans by using a high resolution and then scaling the images down. Blowing images up is asking for quality problems, so I’ve always had better luck just doing it ridiculously high and then scaling them.
BTW, GIMP does have a plugin for SANE, but do you really want to run GIMP on a Pi?
The third problem is in using VNC. It can be difficult to see the details you need. An alternative to this is perhaps to use XSane, which can run as a server on the Pi and then running the XSane client on your desktop/laptop. Apparently, you can do this even on a Windows client. I haven’t tried any of this, though, and as long as I keep my glasses clean, I think I’ll avoid what sounds like a much bulkier package.
More Pi?
This comes to the end of what I call the “playing around” portion of what I wanted to do with the Pi. In reality, I don’t think I’m going to change it now from being a print/scan server. However, this was about 3rd on the list of things that I in mind for using this Pi, as I had two other ideas that I really wanted to implement. However, now one the machine I was trying to free up might not be freed up after all, it seems, so I really need to keep scanning (if nothing else) off of it.
That doesn’t mean the end, however. I am probably going to get another unit to do other things as time and finances allow. These exercises have been good, but there are other things I really want to do with a Pi. It is capable of so much more, and much of that is offloading even more things off of machines that are slowly but surely declining into obsolescence.
So, stay tuned. 🙂
Woojin says:
Thank you so much for your posting!
Thanks to you, I could set up my RaspberryPi to use my Epson scanner V39
Hope you have a great day!
Will says:
Hi there, I’m trying to setup the same scanner, but with no luck! I’ve tried the steps above… How did you do it?!
Mark says:
Worked for me too! My old Epson XP-102 is now scanning on Raspberry Pi!
Thanks for posting
Bart Elffers says:
Hi John,
Thanks for your post, but it didn’t work for me on a RPI 4, OS Bullseye (up to date) and the EpsonSoftware I found here: http://support.epson.net/linux/src/scanner/iscan/, following your instructions (with DeviceID 0x130 according to lsusb and sudo sane-find-scanner). Scanner won’t be listed with scanimage -L. Result is:
$ sudo scanimage –format=tiff > /home/pi/test.tiff
scanimage: sane_start: Invalid argument
Has it something to do with Bullseye? I tried installing it on other RPI’s and different SD-cards, no working scanner.
I hope you can help me (if you have time) and I certainly know there is no guarantee ;-).
Have nice day.
Bart.
Amsterdam.
John D says:
It’s hard to believe that this post still gets hits after all these years! Unfortunately, the printer I was trying this out on long ago took a leap from the back of an SUV and crashed into a parking lot, so I no longer have this setup. From what I recall, though, nothing worked until creating the proper group permissions and identifying the right IDs.
Make sure your scanner is supported by SANE, http://www.sane-project.org. If not, you might have to use different software. There is another called epkowa at https://www.gsp.com/cgi-bin/man.cgi?section=5&topic=sane-epkowa.
Also, I’ve read online that if the software was compiled for debug mode, there are things you might have to change to get it to work. Otherwise, you might get an error similar to the one you are experiencing. I’d make sure the Epson software isn’t using debug libraries unless you are willing to roll up your sleeves and make more changes.
In addition, something could be missing from the driver package. When I did this, I recall there were a lot of moving parts, so it is easy to miss a step or a package. A missing part of the driver package can cause this error (https://www.reddit.com/r/archlinux/comments/rmreq6/scanimage_sane_start_invalid_argument/).
It also helps to make sure when you reboot in-between configuration changes to make sure the scanner is on and connected. You probably know that, but I don’t want to assume it. In fact, it doesn’t hurt to shutdown and then restart the device before rebooting the Pi for ultimate effect. However, there actually is a bug report about even unplugging the scanner and replugging it back in before restarting, so who knows?
Hope something in there helps.
ubuntupunk says:
Thanks for this, people in living in the Global South appreciate low-tech.