xcall AUI, AUI_IMAGE, IMGOP_ACQUIRE, handle, status, filespec, comp {,appname}
IMGOP_ACQUIRE (7) invokes a TWAIN “Acquire” to retrieve an image from the default TWAIN input device (aka “Data Source”). In the most common case, which involves scanners, this is equivalent to “scan-and-save-image”. Manufacturers of image input devices such as scanners typically provide a TWAIN driver and user interface which allows the user to access the functionality of the device. This way, the application does not need to know any details about the device (such as what kinds of controls and options it has). It just knows that once the Acquire operation is started, it will return with a file (if successful) or an error code (if not).
Parameters
handle
is not actually used here, and is included only for conformity with the other opcodes.
status
returns 0 for success, else an error; see Status Codes.
filespec
is the specification of the file (AMOS or native format) to store the image in. The extension you specify will determine the image format and must be one of the file types listed in the comp table below (e.g. TEST.JPG or DSK9:TEST.BMP[100,20]).
comp
is a compression-related factor determined by the image type:
|
Type |
Explanation | ||
|
JPG |
Values range from 1 to 100, with 100 being maximum size and quality—i.e., minimum compression. 75 is the default and is generally considered the point below which you start to perceive the loss of quality. | ||
|
TIF |
Compression type: 0=none, 2=packbits, 3=Group3, 4=Group4, 5=CCITT Group3. | ||
|
BMP,PCX |
Ignored, not used | ||
|
PNG |
Symbol |
Value |
Meaning |
|
PNGF_ALL |
0 |
Use best filter for each row (best compression) | |
|
PNGF_NONE |
2 |
No filter (fastest) | |
|
PNGF_SUB |
4 |
Difference filter with adjacent pixel | |
|
PNGF_UP |
6 |
Difference filter with previous row | |
|
PNGF_AVG |
8 |
Average filter | |
|
PNGF_PAETH |
10 |
Paeth filter | |
|
To save as an interlaced file, add PNGF_INTERLACE (+1) to any of the above. | |||
appname
is an optional string containing the name of your application, which, depending on the particular TWAIN driver, may be displayed in the title bar of the device’s user interface window.
Comments
Note that the acquisition (scanning) of the image data is independent of the saving of the image file, so it is up to you to specify an image format (via the file extension) that is compatible with the type of scan. (Or conversely, for the scanning operator to select options compatible with the file format.) For example, PCX only supports 1 and 8 bit data, so a 24-bit scan will result in an error while attempting to save the file.