[sane-devel] Paper size selection or detection using adf moving paper past fixed scan sensor

stef stef.dev at free.fr
Sat Dec 29 19:37:48 UTC 2012


Le 28/12/2012 01:35, m. allan noah a écrit :
> In my backends, I have a page-width and page-height, which are used to
> clamp the maximum x/y values. In the event that the paper runs out
> before the user given size, I still pad the image with an appropriate
> background color (which may not be white).
>
> allan
>
> On Thu, Dec 27, 2012 at 6:55 PM, Paul Newall <p.newalls at ntlworld.com> wrote:
>> When flatbed scanning the frontend supplies top left and bottom right
>> positions to the backend to define the scan area.
>> And the frontend calls sane_read until all the data for that area is
>> supplied. If the paper is smaller than the scan area, that is not a problem
>> because the scanner can scan past the edge of the paper.
>>
>> But I have an adf where the paper is passed over a fixed scan head.
>> If the scan area is longer than the paper, the scan head can never provide
>> enough data.
>> Since we have different paper sizes (letter, legal, A4) this is a likely
>> problem.
>> I have a work around for xsane where you can specify a scan dimension.
>> But using simple scan it seems to not be possible to specify scan dimensions
>> other than the maximum.
>>
>> Does anyone know of a solution to this problem? ie a way to set the size of
>> the page after scanning rather than before?
>> I thought of these possibilities:
>> 1. I guess it's possible to have the backend scan the whole page and store
>> the data before replying to the frontend's get_scan_data request. This could
>> allow the backend to change the requested scan dimensions.
>> 2. The backend could scan the paper, and then if it was not long enough,
>> could add white space until the required scan dimensions were met.
>>
>> But are there any more elegant solutions to this problem? For example is it
>> possible for sane_read to return with something like END_PAGE_NOW_STATUS ?
>> Then the front end makes the best use that it can of the data returned so
>> far?
>>
>> Paul Newall
>>
>> --
>> sane-devel mailing list: sane-devel at lists.alioth.debian.org
>> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
>> Unsubscribe: Send mail with subject "unsubscribe your_password"
>>              to sane-devel-request at lists.alioth.debian.org
>
     Hello,

     the way the SANE standard handle this case is explained in section 
4.3.8, backend may set the 'lines' member of the SANE_Parameter struct 
to -1 to signal that the final height isn't known yet. I have 
implemented this in the genesys backend for sheet-fed scanners. Don't 
know how 'simplescan' cope with this, but it works great with xsane.

Regards,
     Stef



More information about the sane-devel mailing list