Barcode is a powerful tool that can transform data, a string or a binary for instance, into image data fast and deterministically (meaning there’s only one image for one particular set of data).
There are many use cases for that technology, as it is evident by the amount of different types of barcodes, but unfortunately barcode reading equipment is pricey which puts a high entry threshold.
However, modern OCR solutions can easily turn this situation around. This simple and fast API can do exactly that.
This API simply detects all the barcodes on a given picture. User can supply a list of barcode types to search for, and can provide an image via link, base64-encoded image string or a direct binary upload via form-data, in that order of priority.
Calling barcode scan API results in a JSON response.
"time": 0.772,
"result": [
{
"value": "t=20200915T2019&s=177.38&fn=9280440300268736&i=56223&fp=2542966661&n=1",
"valuebase64": "dD0yMDIwMDkxNVQyMDE5JnM9MTc3LjM4JmZuPTkyODA0NDAzMDAyNjg3MzYmaT01NjIyMyZmcD0yNTQyOTY2NjYxJm49MQ==",
"type": "QR-CODE"
}
],
"code": 200
The “time” key represents how much time it took for the recognizer to produce the result. It has a timeout of about 11 seconds to decode the data from one picture.
Scanning results are located under the “result” key.
Scanner always delivers base64 representation of the data, in case there was a binary data encoded in the barcode. In that case “value” will be empty, but developer will be able to decode and use the data either way.