ImageRef API in React Native Barcode Scanner SDK
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.
In order to manage memory effectively, the Scanbot SDK uses autorelease blocks to ensure that ImageRefs are released when they are no longer needed. This means that ImageRefs are automatically released at the end of the block in which they were created, so no manual memory management is required. However, if you need to use an ImageRef outside the current autorelease block, you can serialize it and later deserialize it.
ImageRef from Encoded Buffer
ImageRef can be created from an encoded image buffer, which is a base64 string containing the image data in a specific format (e.g., JPEG, PNG). This allows you to work with images that are already in memory without needing to save them to disk first.
loading...
ImageRef from File URI
ImageRef can also be created from a file URI, which is a string representing the location of an image file on the device's storage.
loading...
Utilizing ImageRef
Once you have an ImageRef, you can use it with various SDK components that accept ImageRef as input. ImageRef can also be used to save images to disk or convert them to encoded buffers for further processing.
loading...
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get free trial licenseIf ImageRef usage is needed outside the current autorelease block, serialize it and later deserialize it within a new autorelease block. This ensures proper memory management and release when the ImageRef is no longer needed.
Buffer Serialization and Deserialization
The ImageRef can be serialized to a buffer and deserialized back to an ImageRef when needed.
loading...
Reference Serialization and Deserialization
The ImageRef can also be serialized to a reference uniqueId string and deserialized back to an ImageRef
loading...
Scanbot SDK is part of the Apryse SDK product family
A mobile scan is just the start. With Apryse SDKs, you can expand mobile workflows into full cross‑platform document processing. Whether you need to edit PDFs, add secure digital signatures, or use a fast, customizable document viewer and editor, Apryse gives you the tools to build powerful features quickly.
Learn more
