Re: a priori image dimensions

David Mosberger-Tang (davidm@azstarnet.com)
Mon, 26 May 1997 09:43:57 -0700

>>>>> On 26 May 1997 09:44:37 -0600, Gordon Matzigkeit <gord@m-tech.ab.ca> said:

Gord> Hi! Here's question for the list before I spend the time to
Gord> download sane-0.57...

Gord> A problem that I've discovered in my PINT backend is that the
Gord> dimensions (both X and Y) cannot be known until the scan is
Gord> started. I've noticed the following line in the TODO:

That is correct. But x can be known before the first chunk of data is
read. The specs allow only y to be unknown once a scan has started
(primarily to accommodate hand-scanners).

Gord> - xscan: scanning of images whose heights is not known a
Gord> priori is not supported yet; this is going to be important for
Gord> handheld scanners

Gord> Does anybody have ideas on how to implement this, and/or has
Gord> it been done in 0.57?

The code in preview.c handles this properly, but the actual scan
engine in xscanimage.c doesn't. In standalone mode, we could use code
similar to the one in scanimage.c whereas in GIMP mode we would have
to increase the image size as scanning progresses.

Gord> The easiest way I can think of is to have a call to
Gord> sane_get_parameters after the scan has completed to find out
Gord> what actually happened.

The problem is that sane_get_parameters() will return a height of -1
for hand-scanners, so you do have to read all the data to find how
tall the image is.

Gord> Maybe space for the PNM header could be reserved before the
Gord> raw data is written, such as:

That sounds like a reasonable strategy as it would maintain the
property that xscanimage never buffers an entire image itself.

--david

--
Source code, list archive, and docs: http://www.azstarnet.com/~axplinux/sane/
To unsubscribe: mail -s unsubscribe sane-devel-request@listserv.azstarnet.com