How to work with the Web Data Capture Modules' image objects
JavaScript has various forms of image representation, such as ArrayBuffer, Uint8Array and ImageData.
Sometimes they are encoded into a certain format like JPEG or PNG, sometimes they contain raw pixel data.
Furthermore, if you fetch your image from an external API or upload it from the user's device,
you might end up with a Blob or a File object.
To provide a simple and unified interface to work with, the Scanbot SDK uses special image objects.
Usage
Creating an image object from any of the aforementioned image representations is straightforward.
All you have to do is to pass your data to static Image construction functions. Below are some examples of this.
Uploading an image
When you have an image file from the user's device, you can do the following:
loading...
Downloading an image
If the image is on the server, you can fetch it and create an image object as follows:
loading...
Extracting from a canvas
If you're working with a Canvas element, you can extract the image data and create an image object like this:
loading...
Please refer to the API documentation for a description of all its properties.
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get free trial license