Scanning a barcode from an image
The Barcode Scanner efficiently analyzes a still image to identify and extract information from any barcodes present. Once detected, the scanner returns the barcode data in the result.
Processing the image
With the Scanbot SDK, you can detect barcodes from a still image, such as a JPG from the Photo Library or another source. The image should be provided as a file URI.
Single image barcode detection
To detect barcodes from a single image:
Uri file = ...;
List<BarcodeFormat> barcodeFormats = ...;
BarcodeAdditionalParameters? additionalParameters = ...;
List<BarcodeDocumentFormat> acceptedDocumentFormats = ...;
var result = ScanbotSdk.detectBarcodesOnImage(
file,
barcodeFormats: barcodeFormats,
additionalParameters: additionalParameters,
acceptedDocumentFormats: acceptedDocumentFormats
);
- Result:
result.barcodeItems
- A list of recognized barcodes as items ofBarcodeItem
type.
For a complete list of parameters and detailed descriptions, refer to the API documentation.
Multiple images barcode detection
To detect barcodes from multiple images:
List<Uri> files = ...
List<BarcodeFormat> barcodeFormats = ...
BarcodeAdditionalParameters? additionalParameters = ...
List<BarcodeDocumentFormat> acceptedDocumentFormats = ...
var result = ScanbotSdk.detectBarcodesOnImages(
files,
barcodeFormats: barcodeFormats,
additionalParameters: additionalParameters,
acceptedDocumentFormats: acceptedDocumentFormats
);
- Result:
result.barcodeItems
- A list of recognized barcodes as items ofBarcodeItem
type.
For a complete list of parameters and detailed descriptions, refer to the API documentation.
BarcodeAdditionalParameters
A class that contains additional parameters for barcodes detection and filtering.
Click to expand properties
/// GS1 handling mode
Gs1HandlingMode? gs1HandlingMode;
/// Minimum required text length of the detected barcode.
/// The default is 0.
/// NOTE: Currently works for ITF barcodes only!
int? minimumTextLength;
/// Maximum text length of the detected barcode. Setting to zero removes the limit.
/// The default is 0.
/// NOTE: Currently works for ITF barcodes only!
int? maximumTextLength;
/// Minimum required quiet zone on the barcode. Measured in modules (the size of minimal bar on the barcode).
/// The default is 10.
/// NOTE: Currently works for ITF barcodes only!
int? minimum1DBarcodesQuietZone;
/// The checksum algorithm for MSI Plessey barcodes.
/// The default value is `Mod10'
MSIPlesseyChecksumAlgorithm? msiPlesseyChecksumAlgorithm;
/// With this option enabled, the scanner removes checks 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`
bool? stripCheckDigits;
/// The expected density of QR codes in an image.
CodeDensity? codeDensity;
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get your free Trial LicenseWhat do you think of this documentation?
What can we do to improve it? Please be as detailed as you like.