Soapbox of Destiny

$ cat /dev/brain > here

26 notes

Using a scanner from the command line with Ubuntu

Here’s a brief article on how to setup and use your scanner from the command line.

I currently have a HP Deskjet F300 all in one printer/scanner connected to my ubuntu server. While network machines can access the printer half of the device through CUPS/Samba, I’ve traditionally had to unplug it from the server and plug it into my laptop to use the scanner.

So I did a bit of research and have figured out how to scan from the command line, which means I can just ssh in, execute the appropriate command and retrieve the resulting image from the samba share on my laptop.

The technology is based around the SANE (Scanner Access Now Easy) library, and its very, very simple to get working on Ubuntu.

Here are the steps:

1. Install SANE

From the command line, execute the following command:

$ sudo apt-get install sane sane-utils

2. See if SANE recognises any of your scanning devices

From the command line, execute the following command:

$ sudo scanimage -L

The resulting output should be something like:

device `hpaio:/usb/Deskjet_F300_series?serial=CN68FGJ10Q04KH' is a Hewlett-Packard Deskjet_F300_series all-in-one

If no scanner devices are detected, you may need to install the relevant drivers to support your particular hardware.

3. Add users to the ‘lp’ group

To access the scanner as an ordinary user, you must be a member of the ‘lp’ group. To make yourself a member, execute the following command:

$ sudo gpasswd -a username lp

Then log out/log in and you should now have user level access to the scanner. Try running scanimage -L without the sudo qualifier to test this.

4. Scan an image

To scan an image, execute the following command

$ scanimage --format=tiff > scannedImage.tiff

As always check the scanimage man page for more options!

Filed under linux ubuntu scanner commandline sane

  1. leetmrfhaxftw posted this