Re: calculation of bytes to read, bytes per line etc

Oliver Rauch (oliver.rauch@Wolfsburg.DE)
Mon, 28 Jun 1999 09:45:30 +0200

Meino Christian Cramer wrote:

> Hi all!
>
> Currently I am programming a backend for
> the AVISION AV630CS.
>
> One problem appears, to which I have no idea
> how to solve.
>
> At different places of the code, things like
> bytes per line, bytes per page, lines per page,
> dots perl line etc are calculated.
>
> Unfortunatly, there most be some round errors or
> something like that, cause Xscanimage gets (or means)
> a greater amount of bytes to read, than my scanner is
> willing to send.

Hi Meino,

I had the same problems with umax scanners.
In the umax docs there is defined how to calculate
pixels/line and lines - although that sometimes does
not work too -

The princip is the following:
The scanner has an Optical resolution (O) and you
want to scan with the resolution (S)

Example:
Optical Resolution O=300 dpi
Scan Resolution: S=250 dpi

If you scan a full inch, it is simple,
you get 250 pixels.

If you only scan a part of an inch,
you must know which pixels are
used and which are thrown away.

You can calculate this with:
INT[n * O/D]

Example:
The (un)wanted pixles are
1. pixel = INT[0 * O/D]
2. pixel = INT[1 * O/D]
3. pixel = INT[2 * O/D]
4. pixel = INT[3 * O/D]

The number of pixels in full inches is simple the dpi*full inches.
The last broken inch must be calculated the way above.

You can download the recent update (build6) of the umax backend
from my homepage, in the function umax_calculate_pixels
the routine is implemented.

There is still an error in it because I sometimes still have your problem,
but the number of errors is reduced by 90%!

Bye
Oliver

--
EMAIL: Oliver.Rauch@Wolfsburg.DE
WWW: http://www.wolfsburg.de/~rauch

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com