Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Barcode.DetectAsJSON

Detects barcodes and returns JSON.

Component Version macOS Windows Linux Server iOS SDK
Barcode 14.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Barcode.DetectAsJSON"; Image { ; type } )   More

Parameters

Parameter Description Example Flags
Image The image to scan for a barcode.
Can be container with image or an Image reference number from our GraphicsMagick image functions.
$image
type Which scanner to use. Supported types: Aztec, Codabar, Code39, Code93, Code128, DataMatrix, EAN8, EAN13, ITF, PDF417, QRCode, UPCA and UPCE. Pass All to scan for all types.
Defaults to all.
"QRCode" Optional

Result

Returns JSON or error.

Description

Detects barcodes and returns JSON.
We use zxing library internally and can only detect what this library handles.
Internally all images are converted to grayscale. For you getting image, it's very important to get a sharp image.
You may need to rotate or crop the image before sending into this method.

If special characters or umlauts are not recognized correct, you may have a wrong encoding. Most modern apps use UTF8 for encoding.

For MacOS and iOS, you can also detect barcodes with CoreImage.Detect function, which is faster and can better find a barcode on a picture.

For FileMaker Go, please use PSoS and do the scan server side. Or build your own app based on the FileMaker iOS SDK with Xcode and embed the MBS Plugin for on device detection.

Examples

Detect a barcode:

Set Variable [ $r ; Value: MBS("Barcode.DetectAsJSON"; Barcode Detection::InputImage) ]
Set Field [ Barcode Detection::zxing Result ; $r ]

Example result:
[ { "format": "UPC-E", "text": "11234562", "isValid": true, "ecLevel": "", "contentType": "Text", "hasECI": false, "orientation": 0, "isMirrored": false, "isInverted": false, "version": "", "sequenceId": "", "sequenceSize": -1, "sequenceIndex": -1, "symbologyIdentifier": "]E0", "isLastInSequence": false, "isPartOfSequence": false, "lineCount": 60, "position": { "topLeft": { "x": 20, "y": 0 }, "topRight": { "x": 121, "y": 0 }, "bottomLeft": { "x": 20, "y": 59 }, "bottomRight": { "x": 121, "y": 59 } }, "bytes": [49, 49, 50, 51, 52, 53, 54, 50] } ]

See also

This function checks for a license.

Created 21st September 2024, last changed 22nd September 2024


Barcode.Detect - Barcode.DrawBarcode