Install qrscan and scan your first barcode image
The Barcode Scanner CLI is QR Code AI’s open-source command-line reader for barcode images. It installs a single binary, qrscan, for macOS, Linux and Windows, with no account needed. Run it on your local machine to turn a label image into structured JSON without a browser: your script launches qrscan, parses the report and checks the shell exit code.
Install the CLI
Pick the distribution channel for your operating system. Every channel installs the same qrscan executable.
brew install qrcode-ai-com/tap/qrscanThe distribution 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 reads QR codes too: see the QR Code Scanner CLI guide.
Test with the public sample image
Begin with a public file anyone can fetch: an EAN-13 sample from the scanner repository. The first command downloads it as ean13.png; the second scans it locally and extracts the first detection with jq. Passing --budget-ms 0 removes the time cap so results remain 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 example requires jq, a command-line JSON processor.
These commands are written for bash or zsh.
What the command outputs
The first detection returned in that report:
{
"symbology": "ean13",
"content": {
"text": "9506000134352",
"raw": "OTUwNjAwMDEzNDM1Mg==",
"charset": "utf8"
},
"payload": {
"kind": "gs1",
"elements": [
{
"ai": "01",
"value": "09506000134352"
}
],
"gtin": "09506000134352",
"conformant": true,
"issues": []
}
}symbology reports the detected format, content.text holds the digits exactly as encoded and payload gives their GS1 interpretation: Application Identifier 01 ("ai": "01") carrying the same value as a 14-digit GTIN, complete with its leading zero.
The scanner’s published example report shows this exact detection.
Consult the CLI reference for every flag, output mode and exit code.
Scan your own label image
Supply the path to a local image file, shown here as inventory-label.png. qrscan prints the scan report as JSON and sets its exit code accordingly. For a Code 128 label encoding STOCK-4827, the report returns both that identifier and its symbology.
qrscan "inventory-label.png" --profile fastqrscan provides three profiles: full (the default) calculates a full-depth scannability score for the first code in the report, fast calculates it at reduced depth and frame decodes without scoring. The “JSON report” example passes fast, while the “Decoded text only” example omits --profile and therefore uses full.
detections[0] refers to the first code listed in the report. If a label image also includes a QR code, qrscan lists the QR code first: filter by symbology instead, for example jq -r '.detections[] | select(.symbology == "code128") | .content.text'.
To build your own test image, create a test barcode with Barcode Generator using Code 128 and STOCK-4827. Download the PNG as inventory-label.png, then pass that file to qrscan.
Because a shell pipeline reports the exit code of jq rather than qrscan, write the JSON report to a file first to branch on qrscan’s exit code, or enable set -o pipefail.
