Table of contents

ImageIO

The ImageIO class provides API to handle image input/output operations such as saving images to the file system. This class allows the library to read and write image data to the file system.

Definition

Assembly: dynamsoft-capture-vision-react-native

class ImageIO

Methods

Method Description
readFromFile Reads an image from a file at the specified file path and returns an ImageData object that represents the image.
readFromMemory Reads an image from ArrayBuffer memory.
saveToFile Saves the provided ImageData object (which represents an image) to a file at the specified file path.
saveToMemory Saves the provided ImageData object (which represents an image) to ArrayBuffer memory.

readFromFile

Reads an image from a file at the specified file path and returns an ImageData object that represents the image.

readFromFile(path: string | null | undefined): ImageData | null | undefined

Parameters

path: The absolute file path, name and extension name, as a string, of the image to be read.

Returns

The image data, of type ImageData, or null if the image cannot be read.

readFromMemory

Reads an image from ArrayBuffer memory.

readFromMemory(data: ArrayBuffer | null | undefined): ImageData | null | undefined

Parameters

data: The image data, of type ArrayBuffer.

Returns

The image data, of type ImageData, or null if the image cannot be read.

saveToFile

Saves the provided ImageData object (which represents an image) to a file at the specified file path.

saveToFile(imageData: ImageData | null | undefined, path: string | null | undefined, overWrite: boolean): void

Parameters

imageData: The image data, of type ImageData.

path: The absolute file path, name and extension name, as a string, of the image to be saved.

overWrite: Whether to overwrite the file if it already exists.

saveToMemory

Saves an image to the specified path and format. The desired file format is inferred from the file extension provided in the path parameter.

saveToMemory(imageData: ImageData | null | undefined, format: EnumImageFileFormat): ArrayBuffer | null | undefined

imageData: The image to be saved, of type ImageData. format: The format of the image data, of type EnumImageFileFormat.

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article: