Notice: This documentation is archived. For the latest product features and documentation, please visit Dynamsoft Capture Vision Documentation.
DDNImage
Stores the normalized image data. Extends from DSImage
.
APIs
API | Descriptions |
---|---|
toCanvas() |
Converts the DDNImage to HTMLCanvasElement . |
toImage() |
Converts the DDNImage to PNG or JPEG image. |
toBlob() |
Converts the DDNImage to Blob . |
toCanvas
Converts the DDNImage to HTMLCanvasElement
.
toCanvas: () => HTMLCanvasElement;
Return value
An HTMLCanvasElement that holds the normalized image data.
Code snippet
let canvas = ddnImage.toCanvas();
toImage
Converts the DDNImage to PNG or JPEG image.
toImage: (type?: "image/png" | "image/jpeg") => HTMLImageElement;
Parameters
type
: “image/png” indicates PNG type, “image/jpeg” indicates JPEG type.
Return value
An HTMLImageElement that holds the normalized image data.
Code snippet
let pngImage = ddnImage.toImage("image/png");
toBlob
Converts the DDNImage to Blob
.
toBlob: (type?: "image/png" | "image/jpeg") => Promise<Blob>;
Parameters
type
: “image/png” indicates PNG type, “image/jpeg” indicates JPEG type.
Return value
A promise resolving to the Blob
data that converted from the normalized image data.
Code snippet
let data = await ddnImage.toBlob("image/png");