[sane-devel] Are "scanimage" options sequence dependent?

Dr Rainer Woitok rainer.woitok at gmail.com
Mon May 14 20:11:19 BST 2018


Greetings,

having spent the better part  of last week hunting down  a bug in one of
my scripts  which utterly failed  to OCR the files  produced by "scanim-
age", I finally found the cause to be the way "scanimage" interprets its
options:

$ scanimage --device pixma:MX880_192.168.2.199 --format tiff --mode Color \
  --resolution 300 --source Flatbed -l 0 -t 0 -x 210 -y 297 > scan1.tif
$ scanimage --device pixma:MX880_192.168.2.199 --format tiff --mode Color \
  --source Flatbed --resolution 300 -l 0 -t 0 -x 210 -y 297 > scan2.tif
$ ls -l scan*.tif
-rw------- 1 rainer rainer  1631460 2018-05-13 11:18 scan1.tif
-rw------- 1 rainer rainer 26099760 2018-05-13 11:21 scan2.tif
$ edentify scan*.tif
scan1.tif: TIFF 620x877 @ 75x75dpi (209x297mm) 24 bits, 3 channels

scan2.tif: TIFF 2480x3508 @ 300x300dpi (209x297mm) 24 bits, 3 channels

$

In the first call  the "--resolution" option  is specified  ahead of the
"--source" option,  causing "scanimage"  to ignore the former and to use
the default resolution of 75 dpi.  In the second call the "--resolution"
option is specified after the "--source" option,  causing "scanimage" to
accept it.

I'm not at all sure  whether this is a bug or a feature,  but in case of
the latter the bug is in  "man/man1/scanimage.1"  which completely fails
to point out this unexpected behaviour ... :-)

Sincerely,
  Rainer



More information about the sane-devel mailing list