Difference between revisions of "sane scanner"

From Noah.org
Jump to navigationJump to search
m (Created page with 'Category:Engineering The `scanimage` command-line tool is a bit broken. It does not recognize all of the options that it claims in its help page. For example '''scanimage --…')
 
m
Line 8: Line 8:
 
== a simple scan ==
 
== a simple scan ==
  
The default output format is '''Net PBM''' ('''pnm''' extension).
+
 
 +
This will scan the entire scanning surface. The default output format is '''Net PBM''' ('''pnm''' extension).
 +
 
 
<pre>
 
<pre>
 
scanimage --mode=color --resolution=300 --depth=14 > foo.pnm
 
scanimage --mode=color --resolution=300 --depth=14 > foo.pnm
 +
</pre>
 +
 +
== autocrop a scan ==
 +
 +
Often it is simpler to just scan the entire scanning surface and then crop the resulting image, rather than try to figure out the geometry of the scanning surface and tell the scanner which part to scan.
 +
 +
<pre>
 +
convert foo.pnm -crop `convert foo.pnm -virtual-pixel edge -blur 0x15 -fuzz 15% -trim -format '%[fx:w]x%[fx:h]+%[fx:page.x]+%[fx:page.y]' info:` +repage foo_crop.pnm
 
</pre>
 
</pre>

Revision as of 18:36, 29 October 2011


The `scanimage` command-line tool is a bit broken. It does not recognize all of the options that it claims in its help page. For example scanimage --help gives an error about an unrecognized option, and then it prints help where --help is clearly listed as an option. Each scanner has options that are specific to it (or the SANE driver that talks to it). You can liste the device specific options simply by having scanimage display help. The scanner must be turned on and connected.

scanimage -h

a simple scan

This will scan the entire scanning surface. The default output format is Net PBM (pnm extension).

scanimage --mode=color --resolution=300 --depth=14 > foo.pnm

autocrop a scan

Often it is simpler to just scan the entire scanning surface and then crop the resulting image, rather than try to figure out the geometry of the scanning surface and tell the scanner which part to scan.

convert foo.pnm -crop `convert foo.pnm -virtual-pixel edge -blur 0x15 -fuzz 15% -trim -format '%[fx:w]x%[fx:h]+%[fx:page.x]+%[fx:page.y]' info:` +repage foo_crop.pnm