The Ik8Scan.dll provides a variety of functions to retrieve images from TWAIN scan devices
Ik8Scan.dll Functions:
Function Name | Explanation |
---|---|
IKScanCloseDS | Closes the scan device |
IKScanExec | Retrieves an image from a TWAIN scan device |
IKScanFreeTwain | Frees the TWAIN DLL |
IKScanGetBitDepth | Retrieves the bit depth supported by the scan device |
IKScanGetCapEnum | Retrieves the possible setting values for a specified property of the scan device |
IKScanGetCapRange | Retrieves the range of possible setting values for a specified functionality of the scan device |
IKScanGetDSInfo | Retrieves information about the specified scan device |
IKScanGetMinimumSize | Retrieves the smallest size that can be scanned with a given scan device |
IKScanGetMinimumSizeEx | Retrieves the smallest size in pixels that can be scanned with a given scan device. |
IKScanGetPhysicalSize | Retrieves the largest physical size that can be scanned with a given scan device |
IKScanGetPhysicalSizeEx | Retrieves the largest physical size in pixels that can be scanned with a given scan device |
IKScanGetPixelType | Retrieves the pixel type supported by the scan device |
IKScanInitialize | Starts the TWAIN process |
IKScanIsCapSupported | Confirms whether or not a functionality is supported by the scan device |
IKScanList | Lists the scan devices |
IKScanListLen | Retrieves the length of the scan device list |
IKScanLoadTwain | Loads the TWAIN DLL |
IKScanOpenDS | Opens the scan device |
IKScanSelect | Selects the scan device |
IKScanTerminate | Ends the TWAIN process |
Basic flow of the scan process
[IKScanLoadTwain]
|
IKScanInitialize (required)
|
IKScanGetDSInfo, IKScanList, IKScanListLen, IKScanSelect
|
[IKScanOpenDS]
|
IKScanGetBitDepth, IKScanGetCapEnum, IKScanGetCapRange,
IKScanGetPhysicalSize(Ex) IKScanGetPixeltype,
IKScanGetMinimumSize(Ex), IKScanIsCapSupported
|
IKScanExec
|
[IKScanCloseDS]
|
IKScanTerminate (required)
|
[IKScanFreeTwain]
Note:
The function pairs IKScanLoadTwain/IKScanFreeTwain and
IKScanOpenDS/IKScanCloseDS are in brackets [ ] to emphasize the
fact that although it is not necessary to execute these methods, if
they are used they must be used in pairs. Do not use
IKScanLoadTwain without later using IKScanFreeTwain. Do not use
IKScanOpenDS without later using IKScanCloseDS. Aside from
IKScanLoadTwain/IKScanFreeTwain which loads and unloads the TWAIN
DLL and IKScanInitialize/IKScanTerminate which starts and ends the
scan process, the other scan functions can be used at any time. (Of
course, IKScanFreeTwain should not be used after IKScanLoadTwain
and IKScanOpenDS should not be used after IKScanCloseDS)
Structure definitons and explanations (User-defined types)
IKSCAN_DATASOURCEINFO: This structure refers to the TWAIN
datasource information
(1)C++Builder/Visual C++
typedef struct {
WORD ProtocolMajor;
WORD ProtocolMinor;
char
Manufacturer[34];
WORD ManufacturerLen;
char
ProductFamily[34];
WORD ProductFamilyLen;
char
ProductName[34];
WORD ProductNameLen;
WORD SourceMajor;
WORD SourceMinor;
char
SourceVersionInfo[34];
WORD SourceVersionInfoLen;
} IKSCAN_DATASOURCEINFO;
typedef IKSCAN_DATASOURCEINFO *
PTR_IKSCAN_DATASOURCEINFO;
(2)Delphi
IKSCAN_DATASOURCEINFO = Record
ProtocolMajor:
Word;
ProtocolMinor:
Word;
Manufacturer: array[0..33]
of Char;
ManufacturerLen: Word;
ProductFamily: array[0..33]
of Char;
ProductFamilyLen: Word;
ProductName: array[0..33]
of Char;
ProductNameLen: Word;
SourceMajor: Word;
SourceMinor: Word;
SourceVersionInfo: array[0..33]
of Char;
SourceVersionInfoLen: Word;
end;
(3)Visual Basic
Type IKSCAN_DATASOURCEINFO
ProtocolMajor
As Integer
ProtocolMinor
As Integer
Manufacturer As
String * 34
ManufacturerLen As
Integer
ProductFamily
As String * 34
ProductFamilyLen As
Integer
ProductName
As String * 34
ProductNameLen As
Integer
SourceMajor
As Integer
SourceMinor
As Integer
SourceVersionInfo
As String * 34
SourceVersionInfoLen
As Integer
End Type
ProtocolMajor: Refers
to the TWAIN major version supported by the datasource
ProtocolMinor:
Refers to the TWAIN minor version supported by the datasource
Manufacturer: Refers
to the scan device manufacturer's name
ManufacturerLen: Refers
to the length of the string in Manufacturer *1
ProductFamily: Refers
to the product family name
ProductFamilyLen: Refers to the
length of the string in ProductFamily *1
ProductName: Refers
to the scan device product name
ProductNameLen: Refers to
the length of the string in ProductName *1
SourceMajor: Refers
to the major version of the scan device
SourceMinor: Refers
to the minor version of the scan device
SourceVersionInfo: Refers to the version
information of the scan device
SourceVersionInfoLen: Refers to the length of the string in
SourceVersionInfo *1
*1 - Has been converted from 4 byte type to 2 byte type which is
relevant when converting from the ImageKit6
IKSCAN_EXEC: The member variables of this structure are set
when the image is scanned.
(1)C++Builder/Visual C++
typedef struct {
WORD seSize;
WORD PixelType;
float
Left;
float
Top;
float
Right;
float
Bottom;
long
XResolution;
long
YResolution;
float
XScaling;
float
YScaling;
WORD
BitDepth;
short
Brightness;
short
Contrast;
float
Gamma;
short
Highlight;
short
Threshold;
short
Shadow;
short
Indicator;
short
ScanMode;
LPSTR ScanDsName;
WORD UiMode;
WORD UnitMode;
WORD UnitFlag;
short
PageCount;
WORD Orientation;
WORD TransferMode;
WORD Compression;
WORD PaperSize;
WORD BitDepthReduction;
LPSTR HalfTone;
WORD FileFormat;
short
JpegQuality;
LPSTR FileName;
WORD ImageFilter;
WORD NoiseFilter;
WORD DropoutColor;
WORD BorderDetection;
WORD Deskew;
WORD ScanningSpeed;
WORD MoireFilter;
WORD Sharpness;
WORD RotateBack;
WORD ExtUiMode;
WORD DynamicThreshold;
float
ColorBWRatio;
WORD IgnoreBackColor;
WORD OverScan;
long
SkipBlankPage;
float
SkipBlankThreshold;
WORD RemoveHole;
WORD AdjustGamma;
short
FocusPosition;
long
Rotation;
LPTSTR InformationFileName;
short
TextEnhancement;
} IKSCAN_EXEC;
typedef IKSCAN_EXEC *
PTR_IKSCAN_EXEC;
(2)Delphi
type
IKSCAN_EXEC = Record
seSize:
Word;
PixelType:
Word;
Left:
Single;
Top:
Single;
Right:
Single;
Bottom:
Single;
XResolution:
Longint;
YResolution:
Longint;
XScaling:
Single;
YScaling:
Single;
BitDepth:
Word;
Brightness:
Smallint;
Contrast:
Smallint;
Gamma
Single;
Highlight:
Smallint;
Threshold: Smallint;
Shadow:
Smallint;
Indicator:
WordBool;
ScanMode:
Smallint;
ScanDsName:
PChar;
UiMode:
Word;
UnitMode:
Word;
UnitFlag:
Word;
PageCount:
Smallint;
Orientation:
Word;
TransferMode:
Word;
Compression:
Word;
PaperSize:
Word;
BitDepthReduction:
Word;
HalfTone:
PChar;
FileFormat:
Word;
JpegQuality:
Smallint;
FileName:
PChar
ImageFilter:
Word;
NoiseFilter:
Word;
DropoutColor:
Word;
BorderDetection:
Word;
Deskew:
Word;
ScanningSpeed:
Word;
MoireFilter:
Word;
Sharpness: Word;
RotateBack:
Word;
DynamicThreshold:
Word;
ColorBWRatio:
Single;
IgnoreBackColor:
Word;
OverScan:
Word;
SkipBlankPage:
Longint;
SkipBlankThreshold: Single;
RemoveHole:
Word;
AdjustGamma:
Word;
FocusPosition:
Smallint;
Rotation:
Longint;
InformationFileName: PChar;
TextEnhancement:
Smallint;
end;
(3)Visual Basic
Type IKSCAN_EXEC
seSize
As Integer
PixelType As
Integer
Left
As Single
Top
As Single
Right
As Single
Bottom
As Single
XResolution As
Long
YResolution As
Long
XScaling
As Single
YScaling
As Single
BitDepth
As Integer
Brightness As
Integer
Contrast
As Integer
Gamma
As Single
Highlight
As Integer
Threshold As
Integer
Shadow
As Integer
Indicator As
Integer
ScanMode As
Integer
ScanDsName
As String
UiMode
As Integer
UnitMode As
Integer
UnitFlag
As Integer
PageCount
As Integer
Orientation As
Integer
TransferMode
As Integer
Compression As
Integer
PaperSize As
Integer
BitDepthReduction
As Integer
HalfTone
As String
FileFormat As
Integer
JpegQuality As
Integer
FileName
As String
ImageFilter As
Integer
NoiseFilter As
Integer
DropoutColor As
Integer
BorderDetection As
Integer
Deskew
As Integer
ScanningSpeed
As Integer
MoireFilter
As Integer
Sharpness As
Integer
RotateBack As
Integer
DynamicThreshold
As Integer
ColorBWRatio
As Single
IgnoreBackColor
As Integer
OverScan
As Integer
SkipBlankPage
As Long
SkipBlankThreshold
As Single
RemoveHole
As Integer
AdjustGamma
As Integer
FocusPosition
As Integer
Rotation
As Long
InformationFileName
As String
TextEnhancement
As Integer
End Type
seSize: Sets the size of the IKSCAN_EXEC structure
In C++Builder and Visual C++, use the sizeof operator. In
Delphi, use the SizeOf function and in Visual Basic, use the
LenB function. When 0 is set in seSize, IKSCAN_EXEC includes
members through TextEnhancement.
PixelType: Sets the type of image scanned.
0: Black and White (1bit)
1: Grayscale (4bit, 8bit, 12bit,
14bit, or 16bit)
2: RGB color (24bit, 36bit, 42bit, or
48bit)
3: Palette color (4bit, 8bit)
1000: AutoDetect Black &
white/Color (1 bit, 24 bit)
1001: Black & white and grayscale
(1bit and 8bit)
1002: Black & white and RGB color
(1bit and 24bit)
If UiMode is any value other than 2 or if a digital camera is used
then PixelType is disabled. The possible setting values supported
by a scan device can be retrieved using the IKScanGetCapEnum function. 1000
is only enabled for certain Panasonic scan drivers (with memory
transfer only uncompressed format) or certain Canon DR scan
drivers. 1001 and 1002 are enabled for certain Canon DR scanners,
Panasonic scanners (memory transfer uncompressed only) or PFU
scanners. Use the IKScanIsCapSupported to test
whether or not these are supported by the scan driver.
Left, Top, Right, and Bottom: Set the
scanning position in units specified by UnitMode (0: inches, 1: cm,
5: pixels).
To use the default values of the datasource, set these to 0. Once
the scan has executed, the actual values for Left, Top, Right, and
Bottom will be returned in units specified by UnitMode. When UiMode
is set to values other than 2 or PaperSize is set to values other
than 0, or a digital camera is being used, then Left, Top, Right,
and Bottom are disabled.
XResolution, YResolution: Sets the horizontal and
vertical resolution (DPI)
To use the default values of the datasource, set XResolution and
YResolution to -1. XResolution and YResolution are disabled for
UiMode values other than 2 or when a digital camera is used. The
IKScanGetCapEnum and
IKScanGetCapRange
functions can be used to retrieve the resolution value or range of
values supported by the scan device.
Note: Although it is possible to set different values for the
horizontal and vertical resolution, some datasources (scanner
drivers) do not support different values for horizontal and
vertical resolution. In such cases, either the horizontal
resolution or the vertical resolution will be enabled. To retrieve
the actual resolution, refer to the those values within the
BeforeScanProc function or refer to the member variables after
executing the IKScanExec
function.
XScaling, YScaling: Sets the horizontal and vertical
scaling (Default value is 1.0)
When scanning in actual size set these values to 1.0. XScaling and
YScaling are disabled for UiMode values other than 2, when a
digital camera is used, or when the scan device does not support
scaling. The IKScanGetCapEnum and IKScanGetCapRange functions can
be used to retrieve the scaling values or range of values supported
by the scan device.
Note: Although it is possible to set different values for
horizontal and vertical scaling some datasources (scan drivers) do
not support this. In such cases, either the horizontal scaling
value or the vertical scaling value will be used.
BitDepth: Sets the number of bits per pixel (1, 4, 8, 12,
14, 16, 24, 36, 42, or 48)
When scanning in 12, 14, 16, 36, 42, or 48 bit color, please set
the TransferMode to 2. If you get an error regardless of the value
supported by the datasource, set this to 0. When BitDepth is set to
0 the default value for a given PixelType will be used. BitDepth is
disabled for UiMode values other than 2 or when a digital camera is
used.
Brightness: Sets the brightness (values range from -1000 to
1000, default value is 0)
Contrast: Sets the contrast (values range from -1000 to
1000, default value is 0)
When using Canon DR scan drivers and PixelType is 0,
BitDepthReduction is 0, and TextEnhancement is 1 or more, the
Contrast values range from 1 to 255 (default value 128). When using
PFU scan drivers and PixelType is 1000, 1001, or 1002, the Contrast
values range from -127 to 127 (default value 0).
If the PixelType is 0 then depending on the value of
BitDepthReduction, Brightness and Contrast value may be
ineffective. See below:
Brightness is enabled
When PixelType = 0 and the
BitDepthReduction = 0(*) or 1
When PixelType = 1, 2, or 3
Contrast is enabled
When PixelType = 0 and the
BitDepthReduction = 1
When the PixelType = 1, 2, or 3
(*) This is only for scan devices that do not support Threshold and
use uses Brightness instead.
Brightness and Contrast are disabled for UiMode values other than
2, when a digital camera is used, or when the scan device does not
support these functions. The IKScanGetCapEnum and IKScanGetCapRange functions can
be used to retrieve the values or range of values supported by the
scan device.
Gamma: Sets the gamma correction (Default value is 2.2)
Gamma is disabled for UiMode values other than 2, when a digital
camera is used, or when the scan device does not support this
function. The IKScanGetCapEnum and IKScanGetCapRange functions can
be used to retrieve the Gamma values or range of values supported
by the scan device.
Highlight: Sets the highlight (Values range from 0 to 255,
Default value is 255)
Highlight is enabled when PixelType is 1 or more. Highlight is
disabled for UiMode values other than 2, when a digital camera is
used, or when the scan device does not support this function. The
IKScanGetCapEnum and
IKScanGetCapRange
functions can be used to retrieve the Highlight values or range of
values supported by the scan device.
Threshold: Sets the threshold value (Values range from 0 to
255, Default value is 128)
Threshold is enabled when PixelType is 0 and BitDepthReduction is
0. For scan devices that use brightness instead of threshold, the
Brightness property value will be used. Threshold is disabled for
UiMode values other than 2, when a digital camera is used, or when
the scan device does not support this function. The IKScanGetCapEnum and IKScanGetCapRange functions can
be used to retrieve the Threshold values or range of values
supported by the scan device.
Shadow: Sets the shadow (Values range from 0 to 255, Default
value is 0)
Shadow is enabled when PixelType is 1 or more. Shadow is disabled
for UiMode values other than 2, when a digital camera is used, or
when the scan device does not support this function. The IKScanGetCapEnum and IKScanGetCapRange functions can
be used to retrieve the Shadow values or range of values supported
by the scan device.
Indicator: Sets whether or not the indicator is displayed
when scanning
0: Indicator is not displayed, Nonzero: Indicator is displayed
Indicator is disabled for UiMode values other than 2 or when a
digital camera is used.
ScanMode: Sets the scanning mode
For Scanners - 0: Document plate (transmissive or reflective), 1:
ADF Single Sided (transmissive or reflective), 2: ADF Double Sided
(Duplex) (transmissive or reflective), 7: Positive film, using film
holder, 8: Positive film, using film area guide;
For Digital Cameras - 3: The original images in the digital camera,
4: The original images in the digital camera (using an array), 5:
The thumbnail images in the digital camera, 6: The thumbnail images
in the digital camera (using an array), 100: Manufacturer provided
UI using settings from information file.
ScanMode is disabled for UiMode values other than 2. When ScanMode
is 4 or 6, the array values passed to the IKScanExec function are enabled,
otherwise these array values are disabled. To preserve
compatiblilty with the ImageKit5, when ScanMode is set to 1 and the
XResolution property is set to 0, the original images in the
digital camera can be retrieved. Values of 7 and 8 are enabled for
certain Epson scanners. Value 8 can only be used with devices that
support film area guide. For value 100, be sure to set the path to
the information file in the InformationFileName.
Note: Even if the scan device being used supports duplex scanning,
there are cases where duplex scanning does not operate properly
when the user interface is suppressed (UiMode=2)
ScanDsName: Sets the name of the scan device.
If ScanDsName is not set or is NULL, the scan device selected by
the IKScanSelect function
will be used. ScanDsName is disabled if IKScanOpenDS is used.
UiMode: Sets the user interface used when scanning.
0: UI is displayed but not closed after scanning is completed, 1:
UI is displayed and closed after scanning is completed, 2: UI is
suppressed (Custom-built interface is used), 3: UI is displayed and
values set but scanning is not performed. To check whether this
capability is supported, use the IKScanIsCapSupported
function
UnitMode: Sets the units of measurement when scanning with a
custom built user interface
0: Inches, 1: Centimeter, 2: Pica, 3: Point 4: Twip, 5: Pixel, 6:
Millimeter
When UnitFlag is 0, the scan device must support the unit of
measurement set in UnitMode. UnitMode is disabled for UiMode values
other than 2, however when scanning the units of measurement are
returned. The IKScanGetCapEnum function can be
used to retrieve the UnitMode values supported by the scan
device.
UnitFlag: Sets whether the scan units are determined by the
scan device or by the ImageKit.
(0: datasource function is used to determine the scan units, 1:
ImageKit determines the scan units). Set UnitFlag to 1 when you
want to use a unit of measurement that the scan device does not
support or when PaperSize is 0 and Left, Top, Right, and Bottom are
set but the scan is not correct or the scan area is not enabled,
etc. UnitFlag is enabled when the UiMode property is 2.
Note: When XResolution and YResolution are both -1 (use scan device
default value) and the UnitMode property is 5, the UnitFlag
property is disabled.
PageCount: Sets the number of images to be scanned
To scan all of the images in the ADF or digital camera, set
PageCount to 0 or less. To specify the number of images to be
scanned, set that number in PageCount. When retrieving images from
a digital camera using an array, set PageCount to be the same as
the number of elements in the array. When ScanMode is 2 (ADF
duplex), even if an odd number is set into PageCount, the number of
pages scanned will be an even number (so as to scan both sides of
the paper). PageCount is disabled when the UiMode is NOT 2 or when
using the document plate to scan.
When PixelType is 1001 or 1002, in order to scan one page with two
images, set an even number in PageCount. When the PixelType is set
to 1001 or 1002, for each page, two images are scanned so you
should set the PageCount to an even number. For example, when
scanning both sides of a single page using PixelType set to 1001 or
1002, then set the PageCount to values of 0 or less or to 4. When
using Panasonic scan drivers with the PixelType property is set to
1001 or 1002, set the PageCount to 0 or less (1 or more is
ignored).
Note: Not all scan devices support this functionality. In some
cases where the scan device does not support this function or does
not correctly support this function, after the number of images
specified by PageCount have been scanned, the scanning procedure is
canceled. Depending on the type of equipment, paper could be left
inside the scan device or ADF.
Orientation: Sets the orientation of the paper
0: 0 degrees (protrait orientation), 1: 90 degrees, 2: 180 degrees,
3: 270 degrees (landscape orientation), 1000: Text orientation
detection or automatic rotation; Rotation is counter-clockwise.
Orientation is disabled for UiMode values other than 2, or when a
digital camera is used. The IKScanGetCapEnum function can be
used to retrieve the Orientation values supported by the scan
device. Orientation allows you to do things like rotate the scan
output from the document plate or scan pages from an ADF where the
pages are inserted "on their side" etc. When Orientation is set to
1000, the orientation of the text contained in the document is
recognized and the scan output is rotated in 90 degree increments
to "correct" the text orientation. Canon DR scan drivers use "text
orientation recognition". Panasonic scan drivers use "document
orientation adjustment". Scan drivers that support TWAIN
specification's "automatic rotation" also use the value of 1000. To
check whether or not the scan driver supports 1000, use the
IKScanIsCapSupported. With a scan driver that supports 1000, if the
output is not appropriate, please set the paper to portrait
orientation.
TransferMode: Sets the method of image transfer
0: Native (transferred as DIB), 1: File, 2: Memory (Transferred in
block units), 3: File2 (NOT SUPPORTED BY THE IMAGEKIT)
The IKScanGetCapEnum
function can be used to retrieve the TransferMode values supported
by the scan device.
Compression: Sets the compression format when using
file or memory transfer (TransferMode = 1 or 2)
0: UNCOMPRESSED, 1: PACKBITS, 2: GROUP3-1D, 3: GROUP3-1DEOL, 4:
GROUP3-2D, 5: GROUP4, 6: JPEG, 7: LZW, 8: JBIG, 9: PNG, 10: RLE4,
11: RLE8, 12: BITFIELDS (2,3,4,5 are FAX[CCITT] format; 10,11,12
are BMP format)
When scanning with a custom built user interface (when
suppressing the scan driver's user interface), be sure to set
appropriate values for PixelType and BitDepth. For example Tiff
Group 3 or 4 compression images must be 1 bit color, JPEG images
must be either 8 bit grayscale or 24 bit color.
The IKScanGetCapEnum
function can be used to retrieve the Compression values supported
by the scan device.
Note: Depending on the scan device, only uncompressed format can be
used with file transfer.
PaperSize: Sets the size of the paper
0: User defined size, 1: A4, 2: JIS B5, 3: US letter, 4: US legal,
5: A5, 6: ISO B4, 7: ISO B6, 9: US ledger, 10: US executive, 11:
A3, 12: ISO B3, 13: A6, 14: C4, 15: C5, 16: C6, 17: 4A0, 18: 2A0,
19: A0, 20: A1, 21: A2, 22: A7, 23: A8, 24: A9, 25: A10, 26: ISO
B0, 27: ISO B1, 28: ISO B2, 29: ISO B5, 30: ISO B7, 31: ISO B8, 32:
ISO B9, 33: ISO B10, 34: JIS B0, 35: JIS B1, 36: JIS B2, 37: JIS
B3, 38: JIS B4, 39: JIS B6, 40: JIS B7, 41: JIS B8, 42: JIS B9, 43:
JIS B10, 44: C0, 45: C1, 46: C2, 47: C3, 48: C7, 49: C8, 50: C9,
51: C10, 52: US statement, 53: Business card, 54: Maximum size,
1000: Undefined size
To enable the Left, Top,Right, and Bottom, set PaperSize to 0.
PaperSize is disabled for UiMode values other than 2, or when a
digital camera is used.
Depending on the datasource (scan driver), using a user defined
paper size (0) and setting the scan, may still result in a start
position of the scan being incorrect. If that is the case, please
use one of the above constant values (1 or more) for the paper size
and set it to a NEGATIVE value. (Please refer to the example code
below). In VisualBasic, Integers can be positive or negative
values, however, in Visual C++, C++Builder, and Delphi, to set
PaperSize to a negative value, you must cast it.
Example code: PaperSize value is set to a negative value and the
scan area is set.
(1)C++Builder/Visual C++
IKSCAN_EXEC sc;
sc.PaperSize = (WORD)-3;
sc.RectLeft = 0;
sc.RectTop = 0;
sc.RectRight = 6.9;
sc.RectBottom = 10.2;
(2)Delphi
sc: IKSCAN_EXEC;
sc.PaperSize := Word(-3);
sc.RectLeft := 0;
sc.RectTop := 0;
sc.RectRight := 6.9;
sc.RectBottom := 10.2;
(3)Visual Basic
Dim sc As IKSCAN_EXEC
sc.PaperSize = -3
sc.RectLeft = 0
sc.RectTop = 0
sc.RectRight = 6.9
sc.RectBottom = 10.2
Note: Please set the PaperSize property to a size supported by the
datasource (scan driver) or set it to the largest supported paper
size. With some datasources the PaperSize property has no effect.
Please refer to the scan manufacturer for details.
The possible PaperSize settings supported by a scan device can be
retrieved using the IKScanGetCapEnum function. For
scan devices that only support a fixed paper size or do not support
paper size settings set this property to 0.
When PaperSize is set to "undefined" (1000), the paper size is
automatically detected then the document is scanned, however, with
scanners that can only detect one dimension (either height or
width) there are cases when the automatic detection does not work
properly. To find out if "Undefined" paper size is supported by the
datasource, please execute the IKScanIsCapSupported
function.
BitDepthReduction: Sets the method used to reduce the bit
depth when scanning in 1 bit color.
0: threshold value, 1: halftone, 2: custom halftone*, 3:
diffusion
*Custom halftone is a TWAIN setting that is not supported by the
ImageKit.
BitDepthReduction is enabled when the UiMode is 2 and the PixelType
is 0. BitDepthReduction is disabled when using a digital camera.
When BitDepthReduction is 0, Threshold is enabled (In some scan
devices Brightness is enabled). When the BitDepthReduction property
is 1, HalfTone, Brightness, and Contrast are enabled.
To retrieve the value of BitDepthReduction that is supported by the
scan device, execute the IKScanGetCapEnum function. In
the case where the scan device does not support BitDepthReduction,
but supports either Threshold or HalfTone, then set this property
to 0 or 1 whichever the case may be.
HalfTone: Sets the name of the halftone when scanning in
black and white
HalfTone is enabled when UiMode is 2, PixelType is 0, and
BitDepthReduction is 1. HalfTone is disabled for digital cameras
and scanners that do not support this function. The possible
setting values supported by a scan device can be retrieved using
the IKScanGetCapEnum
functions.
FileFormat: *1
Sets the file format when using file transfer (TransferMode =
1).
0: TIFF, 1: PICT, 2: BMP, 3: XBM, 4: JFIF(JPEG), 5: FPX, 6: TIFF
MULTI, 7: PNG, 8: SPIFF, 9: EXIF, 10: PDF, 11: JP2 (JPEG2000
Part1), 13: JPX (JPEG2000 Part2), 14: DEJAVU, 15: PDF/A (Version
1), 16: PDF/A (Version 2)
Set the appropriate Compression value for the specified FileFormat.
To retrieve the Compression supported by the datasource, execute
the IKScanGetCapEnum
function.
JpegQuality: *1
Sets the JpegQuality for images when using file or memory transfer
(TransferMode = 1 or 2) and when Compression is JPEG)
-4: undefined, -3: low quality, -2: average quality, -1, high
quality, 0 to 100
To retrieve the JpegQuality values or range of values supported by
the datasource, execute the IKScanGetCapEnum or the IKScanGetCapRange
functions.
FileName: *1
Sets the file name when saving a file if using file transfer
(TransferMode = 1) or if using memory transfer with Compression
(TransferMode = 1, Compression = nonzero). The FileName string must
be 255 bytes or less. If an empty string, NULL, nil, or
vbNullString are set, the file will not be created. With file
transfer a filename must be set.
When UiMode is 2 and ScanMode is 0, the file is saved according to
the FileName but in cases where an ADF is used (ScanMode is
nonzero) then before the file extention, a 4 digit sequential
number is appended. (For example Image.bmp -->
Image0001.bmp)
ImageFilter: Sets the image filter *1
0: None, 1: Automatic, : LOWPASS, 3: BANDPASS, 4: HIGHPASS
The ImageFilter can greatly improve image quality. LOWPASS is
recommended for haftone images, BANDPASS for images that include
text, and HIGHPASS for images that include lines. To retrieve the
ImageFilter supported by the datasource, execute the IKScanGetCapEnum function.
ImageFilter is disabled when the UiMode is set to values other than
2 or when the datasource does not support it.
NoiseFilter: Sets the noise filter *1
0: None, 1: Automatic, 2: LONEPIXEL, 3: MAJORITYRULE
Sets the noise reduction filter for black and white images. To
retrieve the NoiseFilter supported by the datasource, execute the
IKScanGetCapEnum
function. NoiseFilter is disabled when the UiMode is set to values
other than 2 or when the datasource does not support it.
DropoutColor: Sets the dropout color *1
0: Red, 1: Green, 2: Blue, 3: None, 4: White
DropoutColor is enabled when PixelType = 0 or 1. To disable the
dropout color, please set 3 or 4. To retrieve the DropoutColor
supported by the datasource, execute the IKScanGetCapEnum function.
DropoutColor is disabled when the UiMode is set to values other
than 2 or when the datasource does not support it.
BorderDetection: Enables automatic border detection *1
0: Disabled, Nonzero: Enabled
The scan area will automatically be set according to the size of
the paper. BorderDetection is enabled when PaperSize = 1000. To
retrieve whether BorderDetection is supported by the datasource,
execute the IKScanIsCapSupported
function. BorderDetection is disabled when the UiMode is set to
values other than 2 or when the datasource does not support it.
Deskew: Sets whether or not deskew is enabled *1
0: Disabled, 1: Enabled, 2: Enabled (with smoothing)
The Deskew is enabled when the PaperSize property is set to 1000.
However, there are cases, depending on the datasource, when the
Deskew is enabled for other paper sizes as well. Deskew with
smoothing is only available for certain Panasonic scan drivers
(memory transfer uncompressed mode only). To retrieve whether
Deskew is supported by the datasource, execute the IKScanIsCapSupported
function. Deskew is disabled when the UiMode is set to values other
than 2 or when the datasource does not support it.
ScanningSpeed: Sets the speed at which a document is scanned
*1
Scanning speed is available only for certain Epson and Panasonic
scanners.
(1) For Epson scan drivers; 0: Quality, 1: Speed
(2) For Panasonic scan drivers; 0: Slow, 1: Normal, 2: Fast
Increasing the speed at which the scan drivers scan a document can
result in reduced quality. To retrieve the ScanningSpeed supported
by the datasource, execute the IKScanGetCapEnum function.
ScanningSpeed is disabled when the UiMode is set to values other
than 2 or when the datasource does not support it.
MoireFilter: Sets the level for removal of moire
interference *1
(1) Epson Scan Drivers - 0: None, 1: Standard (This can be used for
general settings), 2: 85lpi (This can be used for Newspapers), 3:
133lpi (This can be used for Magazines and Catalogs), 4: 175lpi
(This can be used for Pictures)
(2) Canon DR Scan Drivers - 1:None, 2: High Scan Speed, 3: High
Scan Quality
(3) PFU Scan Drivers - 0: None, 1: Moire Filter level 1, 2: Moire
Filter level 2, 3: Moire Filter level 3, 4: Moire Filter level
4
Moire filter is enabled for certain Epson scan drivers, Canon DR
scan drivers, and PFU scan drivers. When using an Epson scanner,
the datasource will be "Epson Scan" which will allow the above
settings. Note that some Epson scanners, depending on the version,
allow for only "on / off" settings. In this case the ImageKit will
accept values of 0 or nonzero. When using a Canon DR driver, this
is enabled for scan resolutions of 300dpi or less. For PFU
scanners, the Moire filter value is enabled when Sharpness is set
to 0.
To retrieve the MoireFilter supported by the datasource, execute
the IKScanGetCapEnum
function. MoireFilter is disabled when the UiMode is set to values
other than 2 or when the datasource does not support it.
Sharpness: Sets the level of sharpness *1
Sharpness is enabled for certain Canon DR, Epson, Panasonic, and
PFU scan drivers.
(1) For Canon DR scan drivers (edge enhancement); 0 through 5: (0
uses the scan driver's default value and has the same effect as 3;
1 weakens edges; 5 strengthens edges)
(2) For Epson scan drivers (unsharp mask); 0: None, 1: Weak, 2:
Normal, 3: Strong
(3) For Panasonic scan drivers (quality); 0: None, 1: Smooth, 2:
Low, 3: Standard, 4: High
(3) For PFU scan drivers (outline enhancement); 0: None, 1: Weak,
2: Standard, 3: High
When using an Epson scanner, the datasource will be "Epson Scan"
which will allow the above gradated settings. Note that some Epson
scanners, depending on the version, allow for only "on / off"
settings. In this case the ImageKit will accept values of 0 or
nonzero.
For Canon DR scanners, the "edge enhancement" is used,
for Epson scanners, the "unsharp mask" is used, and for
Panasonic scanners "image quality" is used. To retrieve the
Sharpness supported by the datasource, execute the IKScanGetCapEnum function.
Sharpness is disabled when the UiMode is set to values other than 2
or when the datasource does not support it.
RotateBack: Sets whether or not the back side of the page is
rotated when scanning on both sides using an ADF *1
Enabled for Epson scan drivers "EPSON Scan", however "EPSON Scan"
Ver.1.x does not support sizes bigger than A4
0: Do not rotate the back side of pages, 1: Rotate the back side of
pages 180 degrees
The "Epson Scan" configuration "Match front and back images
during duplex scanning" is the same as RotateBack = 1.
To retrieve whether RotateBack is supported by the datasource,
execute the IKScanIsCapSupported
function. RotateBack is enabled when the UiMode is 2 and ScanMode
is 2 (ADF Duplex)
ExtUiMode: sets whether or not the extended user interface
is used *1
Extended UI mode is available only for certain Epson scan
drivers.
0: Start up the UI mode that was last used, 1: Start up the
professional mode, 2: Start up the automatic mode, 3: Start up the
home mode, 4: Start up the automatic mode (with no error messages
and supressed UI), 5: Start up office mode; 7: Start up "sheet
feed" mode;
ExtUiMode settings are only possible when displayed with the
standard "EPSON Scan" user interface. For example: In ES Series,
all settings except 2 and 4 are possible. In the GT Series, all
settings except 5 is possible when not connected to the ADF but if
the ADF is connected then settings 2 or 4 are also not
possible.
ExtUiMode is enabled when UiMode is 0 or 1
DynamicThreshold: Sets the dynamic threshold level *1
Dyanamic threshold is only available on certain Panasonic scan
drivers
0: None, 1: Bright, 2: A little brighter, 3: Standard, 4: A little
darker, 5: Dark
Dyanamic threshold functionality allows you to scan text and images
clearly with optimum quality. This property is enabled when UiMode
is 2 and PixelType is 0. The possible setting values supported by a
datasource can be retrieved executing the IKScanGetCapEnum function. When
setting DynamicThreshold to 1 or more, the values set in the
BitDepthReduction, HalfTone, Sharpness, and Threshold will be
disabled.
ColorBWRatio: *1
ColorBWRatio is useful in determining whether or not to scan in RGB
color or black and white. ColorBWRatio sets the allowable ratio of
color pixels in a document for the scanner to scan in black and
white. Beyond this value, the scanner will scan in rgb color.
ColorBWRatio is enabled for certain Panasonic scan drivers
only.
The default value is one, meaning that the scanner will scan in rgb
color. The allowable range that can be set in ColorBWRatio is from
0.01 to 50.00 percent. As the value of ColorBWRatio increases, a
larger proportion of pixels in the document must be color before
the scanner will scan in rgb color. ColorBWRatio is enabled when
UiMode is 2 and PixelType is 1000
IgnoreBackColor: *1
Sets whether or not the background color of the document is ignored
when automatically determining whether to scan in black and white
or in color. IgnoreBackColor is only available with certain
Panasonic scan drivers
0: Ignore the back color, 1: Does not ignore the back color
IgnoreBackColor is enabled when the UiMode is 2 and PixelType is
1000
There are some notable differences between the IKSCAN_EXEC
structure and the IK5SCAN_EXEC structure in the ImageKit5:
1. Pixeltype is now called PixelType
2. Resolution has been divided into Xresolution and YResolution
3. Indicator has been changed from 4 bytes to 2 bytes
4. InUnitMode and OutUnitMode have been unified into UnitMode
5. A number of new member variable have been added
OverScan: *2
Sets whether or not overscan is used when scanning. Overscan refers
to increasing the scanning area to scan beyond that area.
0: Uses the set scan size to scan
1: Considers the scan size setting and automatically scans
2: Uses the scan size setting as a base then increases the top and
bottom dimensions to scan
3: Uses the scan size setting as a base then increases the left and
right dimensions to scan
4: Uses the scan size setting as a base then increases the top,
bottom, left, and right dimensions to scan
Using OverScan, the scanning area (Left, Top, Right, Bottom,
PaperSize) can be increased to capture portions of the document
outside of this area, for example when the paper is not properly
aligned on the document plate. OverScan is enabled with the UiMode
is set to 2. However, it is not enabled when using digital cameras
or scan drivers that do not support overscan. To check whether the
scan driver support overscan use the IKScanGetCapEnum.
SkipBlankPage: sets whether or not blank pages are skipped
*2
-2: Blank pages are not skipped;
-1 Blank pages are skipped
For Canon DR scan drivers:
0: Blank pages are not skipped; 1: Blank pages are skipped
For Epson scan drivers:
0: Blank pages are not skipped; 1: Blank pages are skipped (weak
level); 2: Blank pages are skipped (medium level); 3: Blank pages
are skipped (strong level)
For Canon DR scan drivers and Panasonic scan drivers, use
SkipBlankPage in conjunction with SkipBlankThreshold. For Canon DR
drivers to skip blank pages, ScanMode must be set to 1. When
SkipBlankPage is enabled, even though the ScanMode is 1, both sides
of the paper will be scanned.
For Epson scanners to skip blank pages, set AdjustGamma to 1. When
the AdjustGamma is set to 0, there are cases where the skip blank
page functionality doesn't work properly.
SkipBlankPage is enabled when the UiMode is 2. The possible setting
values supported by a scan device can be retrieved using the
IKScanGetCapEnum or the
IKScanGetCapRange.
SkipBlankThreshold: sets the threshold for determining if a
page is blank or not. *2
For Canon DR Scan Drivers: The value range is from 0.1 to 20.0 (in
%)
For Panasonic Scan Drivers: The value range from 0.01 to 5.00 (in
%)
For Canon DR, as this value gets smaller, it is more likely
that a page will be determined to be blank. For Panasonic, as this
value gets larger, it is more likely that a page will be determined
to be blank.
SkipBlankThreshold is enabled for Canon DR scan drivers and
Panasonic scan drivers only. SkipBlankThreshold is only enabled
when UiMode=2 and when SkipBlankPage is set to -1 or 1.
RemoveHole: sets whether or not punch hole removal is used.
*2
0: Punch hole removal is not used. (Default); 1: Punch hole removal
is used; (For PFU: The hole is filled with white) 2: Punch hole
removal is used (For PFU: The hole is filled with the surrounding
color)
RemoveHole is enabled for Canon DR scan drivers, Epson scan
drivers, Panasonic scan drivers, and PFU scan drivers. RemoveHole
is only enabled when using a custom-built user interface
(UiMode=2). Setting value 2 is only available for PFU scan
drivers.
However, RemoveHole is disabled for digital cameras and scanners
that do not support this function. To check if this property is
supported by the datasource, use the IKScanIsCapSupported.
AdjustGamma: sets the coefficient used for gamma adjustment.
*2
AdjustGamma is enabled when using and Epson scan driver supporting
this capability
0: Sets gamma adjustment coefficient to 1.0 (Default)
1: Sets gamma adjustment coefficient to 1.8
AdjustGamma is enabled only when using a custom-built user
interface (UiMode=2).
FocusPosition: sets the focus position. *2
The FocusPosition is the point on the document plate where the
focal sensor is. Default value is 0. FocusPosition is in units of
0.1mm. For example to adjust the focus position by 1.0mm, set this
value to 10.
FocusPosition is only enabled when using and Epson scan driver
supporting this capability and when using a custom-built user
interface (UiMode=2).
To retrieve the values supported by the datasource, please use the
IKScanGetCapRange.
Rotation: sets the angle of rotation for the scanned image.
*2
Values range from -360 to 360 (in degrees). Default value is 0.
Negative numbers rotate the image counter clockwise by that number
of degress, positive numbers rotate the image clockwise.
Rotation is enabled when UiMode = 2. Although Orientation is
similiar, when Orientation can only be set to 0, then use Rotation
instead. There are scan drivers that support both Orientation and
Rotation; others that, depending on the value of one of these, will
only rotate by a set number of degrees; and some scan drivers that
use only Rotation and ignore Orientation. Because of this, it is
recommended that when setting Rotation values to something other
than 0, set Orientation to 0. Furthermore, when Orientation is set
to 1000 or when a digital camera is used, or if Rotation is not
supported, the Rotation value will be ignored.
To check whether the scan driver supports Rotation use the IKScanGetCapEnum or IKScanGetCapRange.
InformationFileName: sets the filename and path where the
information file is saved. *2
Using InformationFileName, you can save the settings from the
manufacturer's scan interface (UI) into an information file so that
those settings can be used thereafter. It is necessary to display
the manufacturer's UI at least once, but after values from the UI
have been saved in the information file, you can scan using the
settings from the information file.
TextEnhancement: sets the type of text enhancement used.
*2
TextEnhancement is only enabled when using a custom-built user
interface (UiMode=2).
For Canon DR Scan Drivers
0: Text enhancement is not used (default)
1: Text enhancement is used
2: Advanced text enhancement is used
3: High speed text enhancement is used
4, 5: Advanced text enhancement II is used. (Value depends on the
functions used)
Epson Scan Drivers
0: Character distinction is not used. (default)
1: Standard character distinction is used
2: Strong character distinction is used
TextEnhancement is enabled for Canon DR scan drivers and Epson scan
drivers. For Canon DR drivers, PixelType must be 0 and
BitDepthReduction must be 0. Canon DR drivers refer to this
functionality as "text enhancement". Epson scan drivers refer to it
as "character distinction". The different levels of character
distinction are available on Epson Scan ver 5.0 scan drivers or
higher. TextEnhancement is enabled when the UiMode = 2. The
possible setting values supported by a scan device can be retrieved
using the IKScanGetCapEnum
For some Epson scanners, only settings of enabled and disabled are
allowed. In that case, the ImageKit will accept 0 as disabled and
non-zero as enabled. If the datasource doesn't support this
function then the value is ignored.
*1 These are members newly added in the ImageKit7. This is
important to note if converting ImageKit5 or ImageKit6 programs
*2 These are members newly added in the ImageKit8. This is
important to note if converting ImageKit5, ImageKit6,
or ImageKit7 ActiveX programs
IKSCAN_IMAGEINFO: Retrieves information about the scanned
image
(1)C++Builder/Visual C++
typedef struct {
float XResolution;
float YResolution;
long Width;
long Height;
short BitDepth;
short PixelType;
WORD Compression;
} IKSCAN_IMAGEINFO;
typedef IKSCAN_IMAGEINFO *
PTR_IKSCAN_IMAGEINFO;
(2)Delphi
IKSCAN_IMAGEINFO = Record
XResolution:
Single;
YResolution:
Single;
Width:
Longint;
Height:
Longint;
BitDepth: Smallint;
PixelType: Smallint;
Compression:
Word;
end;
(3)Visual Basic
Type IKSCAN_IMAGEINFO
XResolution
As Single
YResolution
As Single
Width
As Long
Height
As Long
BitDepth As
Integer
PixelType As
Integer
Compression As
Integer
End Type
XResolution: The horizontal resolution *1
YResolution: The vertical resolution *1
Width: The width of the scanned image in pixels
Height: The height of the scanned image in pixels
BitDepth: The number of bits per pixel. *2
PixelType: The pixel type (from 0 to 3)
Compression: The compression method *3
*1: TWAIN specifications allow scanning units to be in inches,
centimeters, and other units. However, regardless of how the scan
units are defined, some scan devices return resolution values in
DPI (dots per inch) only. Furthermore, some datasources will set
XResolution and YResolution values to 1.
*2: 12 and 14 bit grayscale become 16 bit, and 36 and 42 bit color
become 48 bit.
*3: Used when an image is transferred via file or memory transfer.
This value has no meaning in native transfer
IKSCAN_RANGE: Retrieves the range of possible values for a
setting
(1)C++Builder/Visual C++
typedef struct {
float Min;
float Max;
float Step;
float Default;
float Current;
} IKSCAN_RANGE;
typedef IKSCAN_RANGE *
PTR_IKSCAN_RANGE;
(2)Delphi
IKSCAN_RANGE = Record
Min:
Single;
Max: Single;
Step: Single;
Default:
Single;
Current:
Single;
end;
(3)Visual Basic
Type IKSCAN_RANGE
Min
As Single
Max
As Single
Step As
Single
Default As
Single
Current
As Single
End Type
Min: Minimum value
Max: Maximum value
Step: Step value *1
Default: Default value *2
Current: Current value
*1: The range is defined as the difference between the Min and
Max
*2: The default value is defined as the value when the power is
turned on