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, I tried to settle for command line scanning with the scanimage command from SANE. 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:
scanimage –format pnm | convert -format png - test.png
“-” tells convert to use the standard input. Another great example of the power of the command line.