[sane-devel] xsane preview scan?

Jeff Sadowski jeff.sadowski at gmail.com
Thu Jan 4 17:51:53 UTC 2018

I have been working on a php implementation of a scanner interface.

I am making some progress. I have my code at

(Not anywhere ready for mainstream as for now it just lists the
options selected when I hit scan.)

I'm at the point where I want to start a preview and I need to make a
decision of how to get a preview.

I don't see a preview option to scanimage and am curious how xsane
gets it's preview.

When I try a preview with xsane with test:1 scanner I get a perfect
grid. (I had set the "Select the test picture" to Grid)

using scanimage '-h' '-d' 'test:1'

I saw the options for test:1

So I tried

scanimage  '--batch=preview.jpg' '--format' 'jpeg' '--batch-count' '1'
'-d' 'test:1' '--test-picture' 'Grid'

which did not come up with the same grid I get in the preview that xsane shows.

I thought well maybe it is getting the max x and y so I tried

scanimage  '--batch=preview.jpg' '--format' 'jpeg' '--batch-count' '1'
'-d' 'test:1' '--test-picture' 'Grid' '-x' '200' '-y' '200'

that wasn't it either.

Then I noticed xsane can only set x and y up to 20 which is weird.
even the defaults are 80 for x and 100 for y

I tried 20x20 and 80x100
but those didn't result in an image that xsane did either.
I also tried lowest resolutions that isn't it either. So I am curious
how xsane acquires a preview?
Or better yet what is the best way to acquire a preview with scanimage?

I think I would want to have the scanner scan as fast as possible so I
thought lowest resolution.
I also think I want my preview of the full bed so max x and max y
the image I get when I try

scanimage '--batch=preview.jpg' '--format' 'jpeg' '--batch-count' '1'
'-d' 'test:1' '--resolution' '1' '--test-picture' 'Grid' '-x' '200'
'-y' '200'

doesn't even look like a grid at all.

So I thought I'd ask this list for some help.

More information about the sane-devel mailing list