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
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 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:
Set options such as DPI, brightness etc and click on Scan button:
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.
🐧 9 comments so far... add one ↓
|Category||List of Unix and Linux commands|
|Firewall||Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|