Skip to main content

Scanning a barcode from an image

The barcode scanner can quickly analyze a still image and identify any barcodes present within it. Once a barcode is detected, the scanner extracts information and returns the result. Take a look at an example down below:

Example for detecting barcodes on the Image

import Foundation
import ScanbotSDK

func detectBarcodesOnImage() {

// Image containing barcode.
guard let image = UIImage(named: "barcodeImage") else { return }

// Types of barcodes you want to detect.
let typesToDetect = SBSDKBarcodeType.allTypes

// Creates an instance of `SBSDKBarcodeScanner`.
let detector = SBSDKBarcodeScanner(types: typesToDetect)

// Returns the result after running detector on the image.
let result = detector.detectBarCodes(on: image)
}

Want to scan longer than one minute?

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

Get your free Trial License

What do you think of this documentation?