This event is generated just before an image is scanned with the scan device.

[C++Builder]   imagekitcontrolnameBeforeScan(TObject *Sender, int AWidth, int AHeight, int ImageCount)
[Delphi]   imagekitcontrolnameBeforeScan(Sender: TObject; AWidth, AHeight, ImageCount: Integer)

Parameters

Name Explanation
AWidth The width of the image that will be transferred in pixels
AHeight The height of the image that will be transferred in pixels
ImageCount The image count. For a single page image file, this will always be 1. When scanning a multi-page image file, this will tell you which page of the multi-page file is about to be scanned.

Explanation

Within this event it is possible to retrieve information about the actual image data that is being tranferred by referencing such properties as Scan.XResolution, Scan.YResolution, Scan.BitDepth, Scan.PixelType, Scan.Compression.

When the Scan.PaperSize property is set to 1000 or above (vikScanUndefinedSize), the AWidth and AHeight parameters may return values of -1. It is also possible that the AWidth and AHeight parameters may return values bigger than the actual document plate.

When the Scan.PixelType property is set to vikScanPixelAutomation, the retrieved BitDepth and PixelType may be different from the actual image.

To cancel the scan set the Scan.Cancel property to True within this event.

 

Regarding the Scan.XResolution and Scan.YResolution properties:

Although the TWAIN specifications allow scan units to be inches or centimeters, depending on the datasource (scan device) the scan units settings are ignored and DPI is used. Furthermore, if scan units are set to pixels, there are cases where the datasource will return a value of 1 as these resolution properties.

 

Regarding the Scan.BitDepth property:

If scanning in 12 or 14 bit grayscale, the Scan.BitDepth property will have a value of 16. If scanning in 36 or 42 bit color, the Scan.BitDepth property will have a value of 48.

Regarding the Scan.Compression property

This is used when file transfer or memory transfer is used. (For native transfer, this is irrelevant)

 

The ImageKit10 VCL is a product created by Newtone Corporation