Resources Base
Table of contents

WebTwain Edit

Methods

       
Crop() CropToClipboard() CutFrameToClipboard() CutToClipboard()
CopyToClipboard() Erase() Flip() Mirror()
Rotate() RotateEx() RotateLeft() RotateRight()
ChangeBitDepth() SetDPI() ConvertToBW() ConvertToGrayScale()
ChangeImageSize() Invert() SetImageWidth()  

Properties

 
BackgroundFillColor

ChangeBitDepth

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;

Usage notes

The allowed bit depths are 1, 4, 8, 24.


ChangeImageSize

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;

SetDPI

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;

Usage notes

Check out Dynamsoft.DWT.EnumDWT_InterpolationMethod .


ConvertToBW

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;

ConvertToGrayScale

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;

Invert

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;

SetImageWidth

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;

Flip

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;

Mirror

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;

RotateLeft

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;

RotateRight

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;

Rotate

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;

RotateEx

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;

Usage notes

Check out Dynamsoft.DWT.EnumDWT_InterpolationMethod .


Crop

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;

Erase

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;

CopyToClipboard

Syntax

/**
 * Copy the specified image to the clipboard of the operating system.
 * @param index Specify the image.
 */
CopyToClipboard(index: number): boolean;

CutToClipboard

Syntax

/**
 * Cut the specified image to the clipboard of the operating system.
 * @param index Specify the image.
 */
CutToClipboard(index: number): boolean;

CropToClipboard

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;

CutFrameToClipboard

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;

Usage notes

The empty area resulted from the crop/erase/cut will be filled with the colour set with BackgroundFillColor.


BackgroundFillColor

Syntax

/**
 * Return or set the fill colour for the empty area on an image that has been cut/cropped/erased.
 */
BackgroundFillColor: number;

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.

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest Version
  • Version 17.0
  • Version 16.2
  • Version 16.1.1
Change +
© 2003–2021 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support