Dev Center
The properties and methods on this page live in the namespace {WebTwainObject}. {WebTwainObject} denotes the WebTwain
instance. Learn about how to create a web twain object.
Methods
Properties
BackgroundFillColor |
Syntax
/**
* Change the bit depth of the specified image.
* @param index Specify the image.
* @param bitDepth Specify the bit depth.
* @param highQuality Whether to keep high quality.
*/
ChangeBitDepth(
index: number,
bitDepth: number,
highQuality: boolean,
): boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v10.0+ | v10.0+ | v11.0+ | v11.0+ | not supported | not supported |
Usage notes
The allowed bit depths are 1, 4, 8, 24.
Syntax
/**
* Change the size of the specified image.
* @param index Specify the image.
* @param width Specify the new width.
* @param height Specify the new height.
* @param method Specify the algorithm for the change.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
ChangeImageSize(
index: number,
width: number,
height: number,
method: Dynamsoft.DWT.EnumDWT_InterpolationMethod | number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v4.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Syntax
/**
* Change the DPI (dots per inch) of the specified image.
* @param index Specify the image.
* @param xResolution Specify the horizontal DPI.
* @param yResolution Specify the vertical DPI.
* @param resample Whether to resample the image.
* @param method Specify the algorithm for the change.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
SetDPI(
index: number,
xResolution: number,
yResolution: number,
resample: boolean,
method: Dynamsoft.DWT.EnumDWT_InterpolationMethod | number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v8.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Usage notes
Check out Dynamsoft.DWT.EnumDWT_InterpolationMethod
.
Syntax
/**
* Convert the specified image to black & white.
* @param index Specify the image.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
ConvertToBW(
index: number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
not supported | v15.3+ | v15.3+ | v15.3+ | v15.3+ | v16.0+ |
Syntax
/**
* Convert the specified image to grayscale.
* @param index Specify the image.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
ConvertToGrayScale(
index: number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v10.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Syntax
/**
* Invert the colour of the pixels on the specified image.
* @param index Specify the image.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
Invert(
index: number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
not supported | v15.3+ | v15.3+ | v15.3+ | v15.3+ | v16.0+ |
Syntax
/**
* Change the width of the specified image by adding a margin or removing part of the image.
* @param index Specify the image.
* @param width Specify the new width.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
SetImageWidth(
index: number,
width: number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v10.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Syntax
/**
* Flip the specified image.
* @param index Specify the image.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
Flip(
index: number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v6.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Syntax
/**
* Mirror the specified image.
* @param index Specify the image.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
Mirror(
index: number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v4.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Syntax
/**
* Rotate the specified image 90 degrees counterclockwise.
* @param index Specify the image.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
RotateLeft(
index: number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v4.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Syntax
/**
* Rotate the specified image 90 degrees clockwise.
* @param index Specify the image.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
RotateRight(
index: number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v4.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Syntax
/**
* Rotate the specified image by the specified angle.
* @param index Specify the image.
* @param angle Specify the angle.
* @param keepSize Whether to keep the original size.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
Rotate(
index: number,
angle: number,
keepSize: boolean,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v6.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Syntax
/**
* Rotate the specified image by the specified angle.
* @param index Specify the image.
* @param angle Specify the angle.
* @param keepSize Whether to keep the original size.
* @param method Specify the algorithm for the change.
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
RotateEx(
index: number,
angle: number,
keepSize: boolean,
method: Dynamsoft.DWT.EnumDWT_InterpolationMethod | number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v7.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Usage notes
Check out Dynamsoft.DWT.EnumDWT_InterpolationMethod
.
Syntax
/**
* Crop the specified image using the specified coordinates.
* @param index Specify the image.
* @param left Specify the rectangle (leftmost coordinate).
* @param top Specify the rectangle (topmost coordinate).
* @param right Specify the rectangle (rightmost coordinate).
* @param bottom Specify the rectangle (bottommost coordinate).
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
Crop(
index: number,
left: number,
top: number,
right: number,
bottom: number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v6.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Syntax
/**
* Erase a rectangular area from the specified image.
* @param index Specify the image.
* @param left Specify the rectangle (leftmost coordinate).
* @param top Specify the rectangle (topmost coordinate).
* @param right Specify the rectangle (rightmost coordinate).
* @param bottom Specify the rectangle (bottommost coordinate).
* @param successCallback A callback function that is executed if the request succeeds.
* @param failureCallback A callback function that is executed if the request fails.
* @argument errorCode The error code.
* @argument errorString The error string.
*/
Erase(
index: number,
left: number,
top: number,
right: number,
bottom: number,
successCallback?: () => void,
failureCallback?: (
errorCode: number,
errorString: string
) => void
): void | boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v6.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Syntax
/**
* Copy the specified image to the clipboard of the operating system.
* @param index Specify the image.
*/
CopyToClipboard(index: number): boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v4.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | not supported |
Syntax
/**
* Cut the specified image to the clipboard of the operating system.
* @param index Specify the image.
*/
CutToClipboard(index: number): boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v4.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | not supported |
Syntax
/**
* Crop a rectangular area from the specified image to the clipboard of the operating system.
* @param index Specify the image.
* @param left Specify the rectangle (leftmost coordinate).
* @param top Specify the rectangle (topmost coordinate).
* @param right Specify the rectangle (rightmost coordinate).
* @param bottom Specify the rectangle (bottommost coordinate).
*/
CropToClipboard(
index: number,
left: number,
top: number,
right: number,
bottom: number
): boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v4.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | not supported |
Syntax
/**
* Cut a rectangular area from the specified image to the clipboard of the operating system.
* @param index Specify the image.
* @param left Specify the rectangle (leftmost coordinate).
* @param top Specify the rectangle (topmost coordinate).
* @param right Specify the rectangle (rightmost coordinate).
* @param bottom Specify the rectangle (bottommost coordinate).
*/
CutFrameToClipboard(
index: number,
left: number,
top: number,
right: number,
bottom: number
): boolean;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v6.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | not supported |
Usage notes
The empty area resulted from the crop/erase/cut will be filled with the colour set with BackgroundFillColor.
Syntax
/**
* Return or set the fill colour for the empty area on an image that has been cut/cropped/erased.
*/
BackgroundFillColor: number;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
v6.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ | v16.0+ |
Usage notes
By default the colour is white (0xffffff). The byte-ordering of the 24-bit RGB value is RRGGBB. RR represents red, GG represents green and BB represents blue.
Syntax
/**
* Change the image brightness.
* @param index Specify the index of image in buffer.
* @param val Specify the brightness. Allowed values [-1000~1000]. Negative value means decrease the brightness.
*/
ChangeBrightnessAsync(index: number, val: number): Promise<boolean>;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
not supported | v17.2+ | v17.2+ | v17.2+ | v17.2+ | v17.2+ |
Syntax
/**
* Change the image contrast.
* @param index Specify the index of image in buffer.
* @param val Specify the contrast. Allowed values [-1000~1000]. Negative value means decrease the contrast.
*/
ChangeContrastAsnyc(index: number, val: number): Promise<boolean>;
Availability
Desktop Service Edition | WebAssembly Edition | ||||
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) | WASM |
not supported | v17.2+ | v17.2+ | v17.2+ | v17.2+ | v17.2+ |
latest version