Barcode Scanner CLI

Decode barcode label images from shell scripts and CI checks, preserving every full identifier alongside its detected format.

  • 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 upload

    Single binary

  • Supported platforms

    macOS, Linux, Windows

  • Scan report format

    JSON

  • Open-source licence

    MIT

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

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

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 snippet uses jq, a command-line JSON filter.

Commands here follow bash or zsh syntax.

Expected output

The first detection from that scan 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 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 fast

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

Barcode Scanner CLI installation channels

The three 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 from the QR Code AI Homebrew tap. Record the installed version before scheduling a barcode script for recurring batch runs.

Scoop (Windows)

On Windows x64, install qrscan from the QR Code AI Scoop bucket. Verify path quoting rules in PowerShell or Command Prompt when processing label paths with spaces.

Linux packages and musl binaries

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

Arch Linux AUR

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

AppImage and Termux

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

Cargo (crates.io)

Build and install qrscan directly from crates.io via Cargo. Switch to a language SDK guide when your app requires an in-process barcode library instead.

How to decode a barcode image with qrscan

Install qrscan, pass a label image and verify both the JSON report and exit code before updating downstream systems.

  1. Step 1

    Install qrscan and pick your input

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

  2. Step 2

    Check the report and exit code

    Run qrscan and inspect stdout JSON alongside the exit code: 0 decoded, 1 valid empty scan, 2 invalid input or usage.

  3. Step 3

    Pass identifiers safely to your script

    Extract content.text and symbology as strings so leading zeros stay intact. Keep database lookups and stock updates in separate steps.

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

qrscan outputs each detection’s content.text and symbology (such as STOCK-4827 as Code 128 or 9506000134352 as EAN-13) with no automatic product lookup.

A saved Code 128 barcode label passes through a CLI workflow and produces the decoded value STOCK-4827.

Decode STOCK-4827 from inventory-label.png

For inventory-label.png, qrscan outputs STOCK-4827 (Code 128). Preserve every character and leading zero before querying your own inventory system.

Supported barcode formats, profiles and exit codes

Profiles, output and exit codes. qrscan defaults to full, with fast and frame options plus --pretty and --score-only. Branch on exit codes (0 decoded, 1 empty, 2 input error, 3 --score-only timeout); QR codes sort first on mixed labels, and scores are software aids rather than print grades.

Formats 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 itf, ISBN ean13) plus QR. Budgets default to 4,000, 800 and 80 ms; pass --budget-ms 0 in CI. See agent integration guides.

Documentation and licence. Check the CLI command reference for every flag and the open-source scanner repository for source code, release notes and the MIT licence.

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

The CLI is built for shell scripts and CI pipelines. For another workflow, pick the matching guide below.

Barcode Scanner

Decode a single barcode right away in your browser with nothing to install.

Open barcode reader

Barcode Scanner Docker

Run an identical containerised scanner environment across workstations and CI runners.

Explore Barcode Scanner Docker

Barcode Scanner MCP Server

Let an AI assistant decode a label image locally through a structured tool call.

Explore Barcode Scanner MCP Server

Barcode Scanner Skills

Give an AI agent a repeatable local procedure for reading barcode images.

Explore Barcode Scanner Skills

Barcode Scanner SDK

Embed local barcode decoding directly inside your own application.

Explore scanner SDK

Barcode Scanner CLI questions

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

A barcode scanner CLI is a command-line utility that decodes barcodes inside a saved image file and prints their values. QR Code AI’s CLI is the open-source qrscan binary: your script passes an image path, reads a JSON report listing each identifier and its format (such as Code 128 or EAN-13) and checks the shell exit code. It is separate from a browser reader, a camera app or an in-process SDK linked into your code.

Install and run qrscan. 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. With Rust, run cargo install --locked qrcode-barcode-scanner-cli. Then pass the path to your barcode image directly to qrscan.

Yes. qrscan reads only the saved image file you supply and never accesses a camera or handheld scanner. It accepts PNG, JPEG, WebP and GIF images. PDF pages, live camera feeds and USB hardware readers sit outside the binary, so export or capture the image first.

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

No. qrscan outputs decoded values purely as data and never follows links or executes commands. Keep link navigation and shell actions as separate, explicit steps in your script, and never interpolate returned text or a supplied filename directly into a shell command.

They share the same decoding engine and JSON report format, but fit different runtimes: the CLI runs as a standalone shell process, an SDK runs inside your own application code and the Docker image packages qrscan with its container runtime for reproducible jobs across machines.

qrscan outputs a JSON report listing each detected barcode with its string value and symbology. A Code 128 label storing STOCK-4827 returns STOCK-4827 as Code 128; the public EAN-13 sample returns 9506000134352 together with a parsed GS1 payload holding the 14-digit GTIN 09506000134352. Treat the value as an identifier rather than a product record: keep every character including leading zeros and query your own system.

No. A retail number or internal code is purely a lookup key for another database. Decoding it does not prove an assigned GS1 registration, fetch a product title or price, verify authenticity or certify printed-label quality. Run qrscan --capabilities to inspect every barcode symbology your build supports.

No. Decoding a saved image uses zero generation credits and triggers no trial: it is completely separate from QR Code AI’s creation platform and generation API. That service has free creation limits, a seven-day Premium trial triggered by the first dynamic QR code or Smart Link, and Premium requirements for continued use of affected features. Reading a barcode never alters what is encoded, and the scanner is open source under the MIT licence.