Barcode.Scan
------------

Scans for barcodes in a picture.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Barcode](component_Barcode.md) | [11.3](newinversion113.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Barcode.Scan"; Image { ; AllowedTypes } ) 

**MBS**( **"Barcode.Scan";** /\* Scans for barcodes in a picture. \*/  
**$Image**; /\* The image to scan for a barcode.   
Can be container with image or an Image reference number from our GraphicsMagick image functions. \*/   
**$AllowedTypes**) /\* Optional; The list of types to allow.  
Default is empty for all types.  
  
Types allowed: All, EAN8, UPCE, ISBN10, UPCA, EAN13, ISBN13, I25, CODE39, PDF417, QRCode, CODE128, Symbol.e.g. "all" \*/ 

### 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 |  |
| AllowedTypes | The list of types to allow.   Default is empty for all types.      Types allowed: All, EAN8, UPCE, ISBN10, UPCA, EAN13, ISBN13, I25, CODE39, PDF417, QRCode, CODE128, Symbol. | "all" | Optional |

### Result

Returns JSON or error.

### Description

Scans for barcodes in a picture.  
Please use [Barcode.LoadLibrary](BarcodeLoadLibrary.md) once in start script to load zbar library before using this function.  
Works best with black &amp; white picture, so you may enhance contrast.  
  
ZBar is an open source software suite for reading bar codes from various sources, such as video streams, image files and raw intensity sensors. It supports many popular symbologies (types of bar codes) including EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR Code.  
  
ZBar is licensed under the GNU LGPL 2.1 to enable development of both open source and commercial projects.  
  
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 and the zbar library for on device detection.  
  
The JSON array includes objects with following keys:  
  
| Key | Value |
|---|---|
| type | The number for the type of barcode. |
| name | The name of the barcode type. |
| quality | The quality level. |
| text | The content of the barcode. |
| xml | The XML representation from zbar for this barcode. |
| boundsTop | The top of the bounding box. |
| boundsLeft | The left of the bounding box. |
| boundsRight | The right of the bounding box. |
| boundsBottom | The bottom of the bounding box. |
| components | The components of a composed barcodes. |

  
We have a copy of zbar here:  
<https://www.monkeybreadsoftware.com/filemaker/files/Libs/>  
  
With MBS Plugin 13.2, if you didn't call [Barcode.LoadLibrary](BarcodeLoadLibrary.md), this function will try to automatically load zbar library.  
### Examples

Scan for barcodes in picture:

 Set Variable \[ $r ; Value: MBS ("Barcode.Scan"; MyRecord::Picture ) \]   
Set Field \[ MyRecord::QRCodeResult ; $r \]   
Commit Records/Requests \[ With dialog: Off \]  
<small>  
Example result:   
\[ { "type" : 12 , "name" : "UPC-A" , "quality" : 99 , "text" : "725272702703" , "xml" : "&lt;symbol type='UPC-A' quality='99'&gt;&lt;data&gt;&lt;!\[CDATA\[725272702703\]\]&gt;&lt;/data&gt;&lt;/symbol&gt;" , "boundsTop" : 0 , "boundsLeft" : 20 , "boundsRight" : 210 , "boundsBottom" : 49 } \] </small>### See also

- [Barcode.Detect](BarcodeDetect.md)
- [Barcode.LoadLibrary](BarcodeLoadLibrary.md)
- [Vision.DetectBarcode](VisionDetectBarcode.md)

### Release notes

- **Version 12.2**
    - Deprecated [Barcode.Detect](https://www.mbsplugins.eu/BarcodeDetect.shtml) in favor of [Barcode.Scan](https://www.mbsplugins.eu/BarcodeScan.shtml) function.
- **Version 11.3**
    - Added zbar library support to better detect barcodes with [Barcode.LoadLibrary](https://www.mbsplugins.eu/BarcodeLoadLibrary.shtml) and [Barcode.Scan](https://www.mbsplugins.eu/BarcodeScan.shtml) functions.

### Example Databases

- [Barcode/Barcode Detection](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Barcode/Barcode%20Detection.shtml#4ScriptAnchor_)
- [Barcode/Barcodes from Invoices](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Barcode/Barcodes%20from%20Invoices.shtml#2ScriptAnchor_)
- [Barcode/Swiss QR-Code for invoices/Swiss QR-Code for invoices ISO 20022](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Barcode/Swiss%20QR-Code%20for%20invoices/Swiss%20QR-Code%20for%20invoices%20ISO%2020022.shtml#22ScriptAnchor_)

### Blog Entries

- [Claris FileMaker 19.5 available](https://www.mbsplugins.de/archive/2022-06-15/Claris_FileMaker_195_available/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.2pr4](https://www.mbsplugins.de/archive/2022-04-28/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 11.3](https://www.mbsplugins.de/archive/2021-07-27/New_in_MBS_FileMaker_Plugin_11/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 11.3](https://www.mbsplugins.de/archive/2021-07-12/Neues_MBS_FileMaker_Plugin_113/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 11.3 - More than 6500 Functions In One Plugin](https://www.mbsplugins.de/archive/2021-07-12/MBS_FileMaker_Plugin_113_-_Mor/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.3pr5](https://www.mbsplugins.de/archive/2021-06-28/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Using zbar library with FileMaker](https://www.mbsplugins.de/archive/2021-06-21/Using_zbar_library_with_FileMa/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.3pr2](https://www.mbsplugins.de/archive/2021-06-09/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.3pr1](https://www.mbsplugins.de/archive/2021-06-03/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 23th May 2021 , last changed 19th April 2023

  
[Barcode.Modulo10Checksum](BarcodeModulo10Checksum.md) - [Barcode.SetInputMode](BarcodeSetInputMode.md)

[HTML Version](BarcodeScan.shtml)