---
author: einar
comments: true
date: 2007-07-04 21:26:31+00:00
layout: post
slug: command-line-scanning
title: Command line scanning
wordpress_id: 269
categories:
- Linux
---

Recently, I had to do a few scans with my old but trusty BenQ 640BU. Given that I could not use any GUI due to a [long-standing Feisty bug](https://bugs.launchpad.net/bugs/85488), I tried to settle for command line scanning with the scanimage command from [SANE](http://www.sane-project.org). The main problem is that scanimage only saves images in PNM or TIFF formats. I wanted to use JPEG or PNG, but apparently that looked impossible to do.

Instead, I found that  scanimage sends its results to standard output, and also that ImageMagick can accept standard input as source file, it was easy to convert on the fly:

[code lang='c']
scanimage --format pnm | convert -format png - test.png
[/code]

"-" tells convert to use the standard input. Another great example  of the power of the command line.
