Linux: Scan An Image With HP Scanners

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

  • 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=' 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 100×100 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

Select your scanner and you will see main screen with tons of options:

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

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

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

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

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts