Methods
(static) autoCrop(image, options, successCallBack, errorCallBack)
Auto crops given image by detecting document borders. This API is to auto crop an image containing a page/document by detecting its edges.
The accuracy of this depends on the accuracy of edge detection. Generally, noisy backgrounds do not give accurate results. Images containing skewed
data i.e. rotated documents in the image may not be cropped accurately. Auto Crop works well if either the content is perfect landscape or perfect portrait
Parameters:
Name |
Type |
Description |
image |
ImageData
|
ImageData object |
options |
|
Options is a JSON object. There is only one option 'type'
Properties
|
successCallBack |
function
|
callback with cropped image data |
errorCallBack |
function
|
callback with error message to be invoked when something goes wrong |
(static) bitonal(image, successCallBack, errorCallBack)
Process given image into bitonal
Parameters:
Name |
Type |
Description |
image |
ImageData
|
ImageData object. This image is expected to have valid dimensions |
successCallBack |
function
|
callback with bitonal image data (if no error occurs) |
errorCallBack |
function
|
callback with error message to be invoked when something goes wrong |
- Deprecated:
(static) scale(image, options, successCallBack, errorCallBack)
Scale given image and return scaled version of input image.
Parameters:
Name |
Type |
Description |
image |
ImageData
|
ImageData object |
options |
Object
|
Is a JSON object for scaleMegapixels. There is only one option 'scaleMegapixels'
Properties
Name |
Type |
Description |
scaleMegapixels |
Number
|
Approximate output image size.
The scaleMegapixels value must be greater than zero and used to downscale the image, not upscale.
If scaleMegapixels value higher than input image size is given, original image is returned in success callback without any scaling. |
|
successCallBack |
function
|
callback with scaled image |
errorCallBack |
function
|
callback with error message to be invoked when something goes wrong |
(static) setDPI(image, options, successCallBack, errorCallBack)
Change the DPI for the given image. This will return jpeg binary as dataurl.
Parameters:
Name |
Type |
Description |
image |
ImageData
|
ImageData object. This image is expected to have valid dimensions |
options |
Object
|
This is a JSON object containing dpi. There is only one option 'dpi'
Properties
Name |
Type |
Description |
dpi |
Number
|
Image dpi will be set to the specified dpi value. dpi value should be greater than zero. |
|
successCallBack |
function
|
callback with jpeg binary as dataurl (if no error occurs) |
errorCallBack |
function
|
callback with appropriate error message. This function is not called if there is success |