Skip to main content

ImageRef API for the Android Data Capture SDK

Introduction

ImageRef is a lightweight image reference type used throughout the Scanbot SDK to represent image data in a unified and effective manner. Additionally, it acts as a universal interface for images that any component of the SDK captures, processes, or returns.

It enables memory efficient Image processing across the SDK and also makes it cross accessible across the SDKs on supported platforms.

For display, additional processing, or export, the ImageRef can be converted to the specific platform image type.

The following are some examples of useful operations when working with ImageRef:

ImageRef creation from different sources

Currently, on Android, we support four types of factories for ImageRef creation. Each factory has additional options for preprocessing and loading.

ImageRef from bitmap
loading...
ImageRef from stream
loading...
ImageRef from byte array
loading...
ImageRef from file
loading...

ImageRef usage

ImageRef can be used throughout the SDK as an input source for image data. The SDK also uses ImageRef as the output for image crops in scanner results. In general, ImageRef behaves similarly to a bitmap, but it exists in a different memory space and is managed by the SDK.

caution

Please remember to dispose of large ImageRef objects, just as you would with Bitmaps. If not disposed, an unused ImageRef may remain in memory for some time before being released by the SDK.

ImageRef can be used for running detection operations:

Using ImageRef
loading...

It is also possible to get image size data similar to Bitmap:

ImageRef metadata
loading...

It is possible to save an image from an ImageRef to a file. If encryption is enabled in the SDK, its parameters will be used to encrypt the file. Additionally, it is possible to provide a separate encryption logic for a specific file. The same approach applies when creating an ImageRef from a file using a factory.

Save image from ImageRef to file
loading...

Get Bitmap Data

Convert ImageRef to Bitmap
loading...

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get free trial license