Linux: Scan An Image With HP Scanners

by Vivek Gite on September 30, 2008 · 2 comments

Q. I've HP all in one printer / scanner / fax machine installed and I'd love to scan an image using Linux command line or GUI application. How do I scan an image under Linux?

A. SANE (Scanner Access Now Easy) interface API that provides standardized access to any raster image scanner hardware (flatbed scanner, handheld scanner, video- and still-cameras, frame grabbers, etc.). You need to install sane software in order to access device using USB, LPT or network interface. There are various commands for scanning images under Linux:

a] scanimage - It is a command-line interface to control image acquisition devices such as flatbed scanners or cameras.

b] xscanimage / xsane - It provides a graphical user-interface to control an image acquisition device such as a flatbed scanner or a camera. It allows previewing and scanning invidual images and can be invoked either directly from the command-line or through The GIMP image manipulation program.

c] 3rd party Applications: GIMP or OpenOffice.Org and many other Linux application can acquire images using scanner if proper driver is installed.

d] Web interface: Many modern printers and scanners comes with web base tools to scan an image. All you have to do is fire a web browser > Type printer IP address and select Scan option. All scanned images can be viewed and downloaded from browser itself.

Install sane software

scanimage and xscanimage can be installed by typing following command:
$ sudo apt-get install sane sane-utils
Where,

  • sane-utils: API library for scanners -- utilities
  • sane: scanner graphical frontends including GIMP plugin

How do I find out if my scanner detected and driver is installed?

Simply type the following command at a shell prompt to get a list of devices:
$ scanimage -L
Sample Output:

device `hpaio:/net/Photosmart_C5100_series?ip=192.168.0.4' is a Hewlett-Packard Photosmart_C5100_series all-in-one
device `v4l:/dev/video0' is a Noname Pinnacle PCTV 40i/50i/110i (saa virtual device

How do I scan an image from a shell prompt?

To scan with default settings to the file scan-file.pnm, enter:
$ scanimage >scan-file.pnm
Note: You may need to add sudo command to get privileges to scan an image.
To scan 100x100 mm to the file image.tiff (-x and -y may not be available with all devices):
$ scanimage -x 100 -y 100 --format=tiff >old-photo.tiff
To scan with ADF (Auto Document Feeder), you must use "batch mode":
$ scanimage -b --batch-scan=yes > scanned-file.pnm

xsane: Graphical User Interface

Type xsane at a shell prompt:
$ xsane

Fig.01: xsane - Select Device

Fig.01: xsane - Select Device


Select your scanner and you will see main screen with tons of options:
Fig.02: XSane on My Ubuntu Linux Desktop

Fig.02: XSane on My Ubuntu Linux Desktop


Set options such as DPI, brightness etc and click on Scan button:
Fig.03: Sample image scanned with my HP scanner hardware

Fig.03: Sample image scanned with my HP scanner hardware

Other software such as GIMP and OpenOffice.org provides an option to scan and import images directly for editing purpose.

Under GIMP visit File > Acquire > XSane > Device Name to scan images.

Under OpenOffice.org wordprocessor visit Insert > Picture > Scan > Request... to scan images.

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 2 comments… read them below or add one }

1 Francisco October 1, 2008

Hey, I got a HP printer too, I had Ubuntu 8.04 but I am trying kubuntu 8.04 now, and it works great. My computer detected the scanner as soon I plugged it in, so I didn’t have any problems, in ubuntu I used xsane, now in kubuntu i use kooka, which is great too.

hope you solved your problem

Reply

2 Orlando Hincapie August 22, 2011

Using hp scanner 4070 in mode txt doesn’t work and show a message ORC file is not working or missing. Thank for your help

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 3 + 10 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: