Install qrscan and decode your first barcode image
Barcode Scanner CLI is QR Code AI’s open-source command-line tool for reading barcode images. It installs a single binary, qrscan, for macOS, Linux and Windows. It converts an image file into structured decoded data without needing a browser: your script calls qrscan, reads the JSON output and branches on the shell exit code.
Install the CLI
Pick the installation method for your OS. Every channel installs the same qrscan binary.
brew install qrcode-ai-com/tap/qrscanThe distribution guide also covers Debian and Ubuntu .deb packages, Fedora RPMs, static musl binaries, the Arch Linux AUR package, an AppImage, Termux TUR and checksum-verified release archives.
The same qrscan binary decodes QR codes as well: check the QR Code Scanner CLI guide.
Test with the public sample image
Begin with a publicly hosted file: an EAN-13 sample stored in the scanner repository. The first command downloads it as ean13.png, while the second decodes it and filters the first detection using jq. Setting --budget-ms 0 removes the time limit for reproducible output.
curl -fsSL -o ean13.png \
https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/fixtures/symbology/ean13.png
qrscan ean13.png --budget-ms 0 | jq '.detections[0] | {symbology, content, payload}'This snippet requires jq, a command-line JSON processor.
The commands above are written for bash or zsh.
Expected output
The first detection returned in that report looks like this:
{
"symbology": "ean13",
"content": {
"text": "9506000134352",
"raw": "OTUwNjAwMDEzNDM1Mg==",
"charset": "utf8"
},
"payload": {
"kind": "gs1",
"elements": [
{
"ai": "01",
"value": "09506000134352"
}
],
"gtin": "09506000134352",
"conformant": true,
"issues": []
}
}Here symbology identifies the detected barcode format, content.text holds the exact encoded digits and payload gives the parsed GS1 representation: Application Identifier 01 ("ai": "01") containing the same code as a 14-digit GTIN with its leading zero intact.
The scanner’s published sample report shows the exact same detection structure.
See the CLI reference for a full list of flags, output formats and exit codes.
Scan your own image file
Supply the path to your own label image, such as inventory-label.png. qrscan prints the scan report in JSON and returns an exit code. For a Code 128 label encoding STOCK-4827, the report captures both that string and its symbology.
qrscan "inventory-label.png" --profile fastqrscan provides three profiles: full (the default) calculates a full-depth scannability score for the first detected code, fast calculates a lighter score and frame skips scoring to decode only. The “JSON report” example specifies fast, whereas “Decoded text only” leaves --profile unset and defaults to full.
detections[0] points to the first entry in the report. When a label image also contains a QR code, QR codes appear first in the array, so filter by symbology instead, such as jq -r '.detections[] | select(.symbology == "code128") | .content.text'.
To generate a test file yourself, create a test barcode with Barcode Generator using Code 128 and STOCK-4827, save the PNG as inventory-label.png and pass it to qrscan.
In a shell pipeline, the exit status reflects jq rather than qrscan: to act on the scanner’s exit code reliably, save the JSON report to a file first and inspect the status, or enable set -o pipefail.
