Skip to main content

Scanning a barcode from an image | Cordova Barcode Scanner

Barcode Detection from Still Images

ScanbotBarcodeSdk.detectBarcodesOnImage(successCallback, errorCallback, options) This method provides the functionality of detecting barcodes from a still image, e.g. a JPG image from a Photo Library or other source. The image must be passed as a file URI.

Options:

  • imageFileUri - A valid file URI of the image (e.g. file:///some/path/image-with-barcodes.jpg). Supported image formats are JPG and PNG. Please make sure your app has the read permission to access this file.

Result:

  • result.barcodes[] - List of recognized barcodes as items. Same structure as in the startBarcodeScanner result.

Arguments


export interface DetectBarcodesOnImageArgs {
/**
* The input image files URIs
*/
imageFileUris: string[];
/**
* Accepted barcode formats
*/
barcodeFormats?: BarcodeFormat[];
/**
* An optional array of barcode document formats that acts as a detection filter.
* By default all supported document formats will be detected.
*/
acceptedDocumentFormats?: BarcodeDocumentFormat[];
/**
* Optional minimum required text length of the detected barcode.
* The default is 0 (setting is turned off).
* NOTE: This feature works on ITF and MSI Plessey barcodes only.
*/
minimumTextLength?: number;
/**
* Optional maximum required text length of the detected barcode.
* The default is 0 (setting is turned off).
* NOTE: This feature works on ITF and MSI Plessey barcodes only.
*/
maximumTextLength?: number;
/**
* Optional minimum required quiet zone of the barcode.
* Measured in modules (the size of minimal bar on the barcode).
* The default is 10.
* NOTE: This feature works on ITF and MSI Plessey barcodes only.
*/
minimum1DBarcodesQuietZone?: number;
/**
* With this option enabled, the scanner removes check digits for UPC, EAN and MSI Plessey codes.
* Has no effect if both single and double digit MSI Plessey checksums are enabled.
* The default is `false`.
*/
stripCheckDigits?: boolean;
/**
* When set to `true`, the scanner assumes that the barcode can be a GS1 barcode.
* Turn it off if you don't want to see decoded FNC1 characters ("]C1" and ASCII char 29).
* The default value is `true`.
* NOTE: Currently works for CODE128 barcodes only!
*/
gs1DecodingEnabled?: boolean;
/**
* The checksum algorithm for MSI Plessey barcodes.
* The default value is [MSIPlesseyChecksumAlgorithm.Mod10].
*/
msiPlesseyChecksumAlgorithm?: MSIPlesseyChecksumAlgorithm
/**
* If true, enables the mode which slightly decreases the scanning quality and the energy consumption, thus increasing the scanning speed.
* The default is `false`.
* Android only.
*/
lowPowerMode?: boolean;
/**
* Use a filter to determine which type of barcode can be detected; see `BarcodeFilter`.
*/
barcodeFilter?: BarcodeFilter;
}

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?


On this page

Scroll to top