--- title: "Functions of the Image Scanner SDK" slug: "image-scan-sdk-ig-functions-of-the-sdk-5-1-0" updated: 2026-10-22T13:22:17Z published: 2026-10-22T13:22:17Z canonical: "docs.onespan.com/image-scan-sdk-ig-functions-of-the-sdk-5-1-0" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.onespan.com/llms.txt > Use this file to discover all available pages before exploring further. # Functions of the Image Scanner SDK ## Android The Image Scanner SDK decodes QR codes and Cronto images from CameraX frames (`ImageProxy`) or from bitmaps. ## Exposed APIs For Android, the Image Scanner SDK APIs are exposed in the com.vasco.digipass.sdk.utils.qrcodescanner package. For detailed information about the APIs and SDK functions, refer to the technical documentation included in the product package. ### Code types Both decoding methods are static methods on `QRCodeScannerSDK`. They take a `codeType` bitmask that specifies which codes to look for: | `codeType` | Searches for | | --- | --- | | `QRCodeScannerSDKConstants.QR_CODE` | QR codes | | `QRCodeScannerSDKConstants.CRONTO_CODE` | Cronto images | | `QR_CODE + CRONTO_CODE` | Either (Cronto is tried first and, if not found, QR code is tried next.) | ### CameraX-Based Decoding Method (CameraX `ImageAnalysis`) The following method decodes a QR code or Cronto image from a CameraX frame. Use `decodeImage` inside an `ImageAnalysis.Analyzer`. The accepted formats are `YUV_420_888` and `RGBA_8888`. Choose the output format based on the code type you are scanning: | Scanning for | Recommended output format | | --- | --- | | QR codes only | `OUTPUT_IMAGE_FORMAT_YUV_420_888` | | Cronto images only | `OUTPUT_IMAGE_FORMAT_RGBA_8888` | The recommended format avoids an extra conversion step and makes decoding faster: ```kotlin val cameraExecutor = Executors.newSingleThreadExecutor() val imageAnalysis = ImageAnalysis.Builder()    .setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_YUV_420_888)    .build()    .also { it.setAnalyzer(cameraExecutor, CodeAnalyzer()) } class CodeAnalyzer : ImageAnalysis.Analyzer {    override fun analyze(image: ImageProxy) {        try {            val result = QRCodeScannerSDK.decodeImage(                image,                QRCodeScannerSDKConstants.QR_CODE + QRCodeScannerSDKConstants.CRONTO_CODE            )            result.scannedImageData?.let { data ->                // Code found: result.scannedImageFormat is QR_CODE or CRONTO_CODE            }        } catch (e: QRCodeScannerSDKException) {            // See Error Handling below        } finally {            image.close() // Required, otherwise the camera stops delivering frames        }    } } ``` Bind `imageAnalysis` to the lifecycle together with your `Preview` use case, using `ProcessCameraProvider.bindToLifecycle`. ### Bitmap Decoding Method The following method decodes an image containing a Cronto image or QR code from a bitmap such as an image from the device gallery. Use `decodeBitmap` for static images. ```kotlin val result = QRCodeScannerSDK.decodeBitmap(    bitmap,    QRCodeScannerSDKConstants.QR_CODE + QRCodeScannerSDKConstants.CRONTO_CODE ) ``` > The bitmap must be in ARGB_8888 format. When loading photos from the gallery: - Downsample large photos (For example with `BitmapFactory.Options.inSampleSize`.) Full-resolution camera photos are slow to decode, use a lot of memory, and can cause out of memory (OOM) errors. - Decode in sRGB. The decoding of Cronto images relies on color, and wide-gamut photos (e.g. Display P3) shift the colors the SDK reads. On API 26+, set `inPreferredColorSpace = ColorSpace.get(ColorSpace.Named.SRGB)`. ```kotlin val options = BitmapFactory.Options().apply {    inPreferredConfig = Bitmap.Config.ARGB_8888    inSampleSize = sampleSize    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {        inPreferredColorSpace = ColorSpace.get(ColorSpace.Named.SRGB)    } } val bitmap = contentResolver.openInputStream(uri)?.use {    BitmapFactory.decodeStream(it, null, options) } ``` ### Obtain Decoding Results Both decoding methods return a `QRCodeScannerSDKDecodingResultData`: - `scannedImageData: String?` returns the decoded content, or `null` if no code was found. - `scannedImageFormat: Int` returns `QR_CODE`, `CRONTO_CODE`, or `-1` if no code was found. Decoding is CPU-intensive. Always call these methods off the main thread. #### Java The API works in the same manner from Java: ```java QRCodeScannerSDK.QRCodeScannerSDKDecodingResultData result =        QRCodeScannerSDK.decodeImage(image, QRCodeScannerSDKConstants.QR_CODE); String data = result.getScannedImageData(); ``` ## iOS On iOS, the SDK supports the following primary use cases: - Scan and decode a QR code or Cronto image from a single image with the `decodeImage` method - Real-time decoding of QR codes and Cronto images by integrating the SDK with an `AVCaptureSession`; this is enabled with the `configureAndBindSession` method.