Install qrscan and decode your first barcode image
The Barcode Scanner CLI is QR Code AI’s open-source terminal reader for barcode images. It installs one standalone executable, qrscan, across macOS, Linux and Windows. It converts a saved image file into decoded values without a browser: your script calls qrscan, reads the JSON report and checks the shell exit code.
Install the CLI
Pick the channel for your operating system. Every route installs the exact same qrscan binary.
brew install qrcode-ai-com/tap/qrscanThe distribution and install guide also covers Debian and Ubuntu packages, Fedora RPMs, static musl binaries, the Arch Linux AUR package, an AppImage, Termux TUR and checksum-verified release archives.
The same qrscan binary also decodes QR codes: check the QR Code Scanner CLI guide.
Test with the public sample image
Start with a public EAN-13 label from the scanner repository. The first command saves it locally as ean13.png; the second decodes it and pulls out the first detection with jq. Passing --budget-ms 0 removes the time limit so repeated runs stay reproducible.
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 uses jq, a command-line JSON filter.
Commands here follow bash or zsh syntax.
Expected output
The first detection from that scan report:
{
"symbology": "ean13",
"content": {
"text": "9506000134352",
"raw": "OTUwNjAwMDEzNDM1Mg==",
"charset": "utf8"
},
"payload": {
"kind": "gs1",
"elements": [
{
"ai": "01",
"value": "09506000134352"
}
],
"gtin": "09506000134352",
"conformant": true,
"issues": []
}
}symbology names the detected format, content.text preserves the digits exactly as encoded and payload gives their GS1 interpretation: Application Identifier 01 ("ai": "01") formatted as a 14-digit GTIN with its leading zero intact.
The scanner’s published EAN-13 example report shows this exact detection.
See the CLI command reference for every flag, output mode and exit code.
Decode your own label image
Pass the path to your own file, shown here as inventory-label.png. qrscan prints the scan report as JSON and sets its exit code. For a Code 128 label encoding STOCK-4827, the report returns that exact string and its format.
qrscan "inventory-label.png" --profile fastqrscan supports three profiles: full (the default) computes a full-depth scannability score for the first code in the report, fast computes a lighter score and frame decodes only. The “JSON report” snippet runs fast, while “Decoded text only” omits --profile and defaults to full.
detections[0] is the first entry in the report. If a label image also includes a QR code, the report places QR codes ahead of barcodes, so filter by format instead, for example jq -r '.detections[] | select(.symbology == "code128") | .content.text'.
Need a test label? Create a test barcode with Barcode Generator using Code 128 and STOCK-4827, save the PNG as inventory-label.png and pass that file to qrscan.
In a shell pipeline, the shell returns the exit code of jq rather than qrscan. To branch on qrscan’s exit code reliably, save the report to a file first or enable set -o pipefail.
