Barcode Scanner CLI

Scan saved barcode label images from shell scripts and automated pipelines. Preserve every full identifier alongside its detected symbology.

  • Homebrew

    CLI distribution

    View install command
  • Scoop

    CLI distribution

    View install command
  • Cargo

    CLI distribution

    View install command

Barcode Scanner CLI at a glance

  • Runs locally, no cloud

    Single binary

  • Supported platforms

    macOS, Linux, Windows

  • Scan report format

    JSON

  • Open-source licence

    MIT

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/qrscan

The 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.

Shell
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:

JSON
{
  "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 fast

qrscan 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.

Barcode Scanner CLI installation options

The quick-start commands above cover Homebrew, Scoop and Cargo. Below are all published distribution channels by platform, each installing the same qrscan binary.

Homebrew

Install qrscan on macOS or Linux via the QR Code AI Homebrew tap. Record the installed release before promoting a barcode script into recurring batch runs.

Scoop (Windows)

On Windows x64, install qrscan from the QR Code AI Scoop bucket. Check how PowerShell or Command Prompt quotes file paths when reading saved label images.

Linux packages and musl binaries

Download Debian and Ubuntu .deb packages, Fedora .rpm packages, static Linux musl binaries and checksum-verified archives straight from GitHub Releases.

Arch Linux AUR

Install the pre-built qrcode-barcode-scanner-bin package on Arch Linux and derivatives, with release versions tracked on Repology.

AppImage and Termux

Run the portable single-file AppImage on GNU/Linux without a system-wide install, or add qrscan inside Termux on Android via the Termux User Repository.

Cargo (crates.io)

Compile and install qrscan directly from crates.io with Cargo. Choose a language SDK guide instead if your application needs an in-process barcode library.

How to scan a barcode image with qrscan

Install qrscan, supply a saved label image and check both the JSON report and exit code before updating downstream systems.

  1. Step 1

    Install qrscan and supply an image

    Install qrscan through Homebrew, Scoop, Cargo or a release archive. It processes only the image file you pass, never a live camera or USB scanner.

  2. Step 2

    Inspect the report and exit code

    Run qrscan and review stdout JSON alongside the exit code: 0 means decoded, 1 means a valid empty report and 2 means invalid input or usage.

  3. Step 3

    Pass the result into your script

    Store content.text and symbology as strings so leading zeros are never stripped. Catalogue lookups and stock updates stay separate steps.

What a decoded barcode returns: Code 128 and EAN-13 examples

qrscan outputs each detection’s content.text and symbology (for example STOCK-4827 as Code 128 or 9506000134352 as EAN-13) without looking up products.

A saved Code 128 barcode image passes through a terminal CLI workflow and yields the decoded value STOCK-4827.

Extract STOCK-4827 from inventory-label.png

When scanning inventory-label.png, qrscan returns STOCK-4827 as Code 128. Keep every character and leading zero intact, then query your own inventory database.

Supported barcode formats, profiles and exit codes

Profiles, output and exit codes. qrscan defaults to full, with fast and frame profiles available alongside --pretty and --score-only. Branch on exit codes (0 decoded, 1 empty, 2 input error and 3 for a --score-only timeout); QR codes sort ahead of barcodes on mixed images, and scores serve as software diagnostics rather than certified print grades.

Symbologies and CI budgets. One binary decodes 16 barcode symbologies (Code 128, EAN/UPC, ITF, Data Matrix, PDF417, Aztec, MaxiCode and more; GS1-128 reports code128, ITF-14 reports itf and ISBN reports ean13) plus QR codes. Default budgets are 4,000 ms (full), 800 ms (fast) and 80 ms (frame); pass --budget-ms 0 for reproducible CI runs. Browse the agent integration guides.

Documentation and licence. Check the CLI reference for every supported flag and visit the scanner repository for source code, changelog and the MIT licence.

CLI, Docker, MCP server, skill or SDK: which barcode scanner surface fits your workflow?

The CLI works best in shell scripts and CI pipelines. For a different environment, pick the dedicated guide below.

Barcode Scanner

Decode a single barcode straight away, directly in your browser. Nothing to install and no account needed.

Open the barcode reader

Barcode Scanner Docker

Package the same scanner runtime cleanly across every workstation and CI runner.

Explore Barcode Scanner Docker

Barcode Scanner MCP Server

Give an AI assistant local barcode image decoding via a standard tool call.

Explore Barcode Scanner MCP Server

Barcode Scanner Skills

Equip a coding agent with a repeatable procedure for scanning label images.

Explore Barcode Scanner Skills

Barcode Scanner SDK

Embed local barcode decoding directly into your application in your preferred language.

Explore Barcode Scanner SDK

Barcode Scanner CLI questions

Installation, supported files, empty results, safety and licensing.

A barcode scanner CLI is a command-line program that decodes barcodes from an image file and outputs their values in the terminal. QR Code AI provides the open-source qrscan command: your script passes an image path, reads a JSON report containing each identifier and its symbology (for example Code 128 or EAN-13) and checks the exit code. It stays separate from an in-browser reader, a live camera app and an SDK linked directly into your own code.

Install the qrscan binary. On macOS or Linux, run brew install qrcode-ai-com/tap/qrscan. On Windows, add the QR Code AI Scoop bucket and install qrcode-barcode-scanner. If you use Rust, run cargo install --locked qrcode-barcode-scanner-cli. Once installed, run qrscan followed by the path to your barcode image.

Yes. qrscan reads only the saved barcode image you supply and never accesses a camera. It supports PNG, JPEG, WebP and GIF files. PDF documents, live webcams and USB hardware scanners are outside the tool’s scope, so convert or capture an image file first.

Check both the exit code and the JSON report. Exit code 1 signals a valid scan with zero detections, whereas exit code 2 signals invalid input or command usage. Treat an empty scan result as final only when trace.budget_exhausted is false; if a time budget stopped the scan early, rerun the command with --budget-ms 0.

No. qrscan returns every decoded value strictly as data and never opens links or runs decoded text as shell commands. Keep URL navigation and command execution as separate, deliberate decisions in your script, and never splice returned text or an untrusted filename straight into a shell command.

No. All three run the same underlying scanner engine and output the same JSON report schema, but each suits a different setup: the CLI runs as a standalone terminal process, an SDK embeds directly in your own code and the Docker image bundles qrscan in a containerised runtime.

qrscan outputs a JSON report listing every detected barcode with its text value and symbology. A Code 128 stock label encoding STOCK-4827 returns STOCK-4827 with the format Code 128, while the public EAN-13 sample returns 9506000134352 together with a parsed GS1 payload carrying the 14-digit GTIN 09506000134352. Because the returned value is an identifier rather than a product record, preserve every character including leading zeros and look it up in the system that assigned it.

No. A retail number or internal stock reference is simply a lookup key for another database. Decoding it does not prove an assigned GS1 identifier, retrieve a product catalogue name or current price, confirm authenticity or certify printed-label quality. Run qrscan --capabilities to inspect the barcode formats (symbologies) your installed build supports.

No. Decoding an existing barcode image on your local machine uses no generation credits and never starts a free trial: it is completely separate from the QR Code AI creation service and its generation API. That creation service has free creation limits, a seven-day Premium trial triggered by creating the first dynamic QR code or Smart Link, and Premium requirements to continue affected features afterwards. Scanning a code never alters what is encoded in it, and the scanner itself is open source under the MIT licence.