Skip to main content

Scanning barcodes from still images

In addition to detecting barcodes from a live camera stream, the Barcode Scanner SDK can scan barcodes from still images imported from the gallery or any other source.

Initializing the SDK​

Before using the Scanbot SDK, it must be initialized.

Processing the image​

Obtaining the image​

Image picking is platform-specific in KMP. Implement platform-specific logic for Android and iOS, then convert the result to ImageRef.

Scanning barcodes​

Call ScanbotSDK.barcode.scanFromImage() with the source image and a scanner configuration.

Detecting barcodes with result
loading...

Handling the result​

scanFromImage() returns a sealed Result type with two implementations:

  • Result.Success — contains the BarcodeScannerResult with the detected barcodes.
  • Result.Failure — contains the error if the scan could not be completed.

For all available methods, see the Result API reference.

Detecting barcodes
loading...

Want to scan longer than one minute?

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

Get free trial license