Resource Base
Table of contents

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");

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest version(2.2.10)
    • Version 2.x
      • Version 2.0.21
      • Version 2.0.20
      • Version 2.0.11
    • Version 1.x
      • Version 1.0.12
      • Version 1.0.11
      • Version 1.0.10
      • Version 1.0.0
    Change +
    © 2003–2024 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support