Skip to main content
Version: v8xxx

Extract document images

BlinkID can return images alongside extraction results. This is useful when you need to pass the captured document images to a downstream service—such as the BlinkID Verify API—or store them for audit purposes.

Types of images​

BlinkID can return two distinct types of images:

  • Input images (raw camera frames): the original, unprocessed frames captured by the camera, including the background around the document.
  • Document images (cropped): perspective-corrected images tightly framed on the document itself.

If you are passing images to Verify, use raw input images.

Capture images for Verify with a use case​

note

Added in BlinkID Web v8003.0.0, and in BlinkID Android and iOS v8002.0.0. Earlier v8xxx versions don't have use cases; follow Enable image return instead.

If you are passing images to Verify, use the Verify capture use case. It enables input image return, face image extraction, and barcode image return, and reads the VIZ from a single best frame instead of combining multiple frames.

import { createBlinkId } from "@microblink/blinkid";

const blinkId = await createBlinkId({
licenseKey: "your-license-key",
presetScanningSettingsBuilder: (presetBuilder) =>
presetBuilder.buildVerifyCaptureSettings(),
});

Then continue with Access images on the result.

Enable image return​

note

Applies to versions earlier than BlinkID Web v8003.0.0, and BlinkID Android and iOS v8002.0.0. If you have a newer version and are passing images to Verify, you can also use the Verify capture use case.

Set inputImageReturnEnabled: true inside documentCaptureModule:

const settings: ScanningSettings = {
documentCaptureModule: {
inputImageReturnEnabled: true,
},
};

To also receive cropped document or face images, set the corresponding flags in documentCaptureModule:

const settings: ScanningSettings = {
documentCaptureModule: {
inputImageReturnEnabled: true,
documentImageReturnEnabled: true,
faceImageExtractionEnabled: true,
},
};

Access images on the result​

The result contains inputImageFront, inputImageBack, and inputImageBarcode fields with the raw ImageData frames.

Encode to PNG before sending to an API:

const canvas = document.createElement("canvas");
canvas.width = result.inputImageFront.width;
canvas.height = result.inputImageFront.height;
canvas.getContext("2d")!.putImageData(result.inputImageFront, 0, 0);
const base64 = canvas.toDataURL("image/png").split(",")[1];

Use lossless compression​

Do not use lossy compression (such as JPEG) on images you intend to pass to a verification backend. Lossy compression degrades image quality in ways that can affect analysis. Encode to PNG instead, as shown in the examples above.

Do not post-process images​

Pass the images as-is from the SDK result. Do not crop, resize, rotate, or otherwise modify them after capture. Post-processing can break assumptions that downstream services make about image integrity.