napari Barcode Scanner Plugin

Extract every 1D and 2D barcode from a 2D napari image layer offline inside napari's Python process. Outlines and labels exact identifiers with leading zeros preserved.

Install from PyPI using pip

Runs inside your current napari environment (or append [all] to pull in napari and Qt together).

  1. 1

    Execute pip install inside the Python environment running napari.

    Shell
    python -m pip install napari-qrcode-barcode-scanner
  2. 2

    Load a 2D greyscale, RGB or RGBA image and open Plugins → Scan QR codes and barcodes (QR Code & Barcode Scanner).

  3. 3

    Pick layer, profile (fast default, frame or full) and budget_ms, then click Run to generate '<layer> codes'.

Requires numpy, magicgui and the prebuilt qrcode-barcode-scanner wheel; keeps source layer pixels unchanged.

Open on PyPI

Outline and script barcode scans on 2D layers

Pair interactive Shapes overlays with the Python scan_layer helper for reproducible imaging workflows.

Transform-aligned Shapes overlays

Builds '<layer> codes' preserving scale, rotation, shear and affine transforms: scan lines for 1D barcodes and four-corner polygons for 2D codes.

scan_layer Python API

Invoke scan_layer(layer, profile, budget_ms) from Python scripts to pull exact strings (leading zeros kept intact) from features['text'] and full metadata.

2D planes & contrast limits

Decodes 2D greyscale, RGB, RGBA and full-resolution multiscale layers using active contrast limits; split 3D stacks via Layers → Split Stack first.

Test a barcode image in napari

Generate a known reference image, execute the scan and check the decoded output character by character.

barcode-reference.png

Create a Code 128 barcode encoding STOCK-4827 and save it as barcode-reference.png.

Run scan_layer in napari

Python
from napari_qrcode_barcode_scanner import scan_layer

data, meta, kind = scan_layer(viewer.layers["barcode-reference"], profile="fast", budget_ms=0)
print([text for text in meta["features"]["text"]])
Expected result · Code 128
STOCK-4827

napari draws the barcode overlay on a transform-aligned Shapes layer and returns the exact Code 128 identifier inside meta['features']['text'].

Sample result for barcode-reference.png.

napari Barcode Scanner plugin questions

Setup routes, 2D layers vs 3D stacks, Shapes transforms, scan_layer scripting and licensing.

Execute python -m pip install napari-qrcode-barcode-scanner inside your napari environment (or append [all] to install napari and Qt together), or navigate to Plugins → Install/Uninstall Plugins in napari and search qrcode. Refer to napari hub and PyPI.

No. The plugin handles 2D greyscale, RGB and RGBA layers (plus multiscale images at full resolution). For 3D stacks or volumes, separate slices first via Layers → Split Stack or project the volume onto a 2D plane.

No. Pixels are read into memory through the layer's active contrast limits without altering the original image layer, and all detections are written to a separate '<layer> codes' Shapes layer.

Matrix symbols (including QR Code and Data Matrix) are outlined using their four corners, whereas 1D barcodes appear as the scanned line across the bars. Because the Shapes layer inherits the image's scale, translation, rotation, shear and affine transform, overlays stay accurately aligned.

Yes. Import scan_layer from napari_qrcode_barcode_scanner and pass your napari image layer alongside profile and budget_ms. The function returns (data, meta, kind), placing decoded strings inside meta['features']['text'] and the complete report inside meta['metadata']['qrcode_barcode_scanner'].

Yes. It reads 16 barcode symbologies (including Code 128, Code 39, Data Matrix, EAN-13 and PDF417) alongside QR codes completely offline, retaining exact identifiers and leading zeros inside shape features and metadata with zero external database queries.

Yes. Both the plugin source code and the current PyPI engine wheel are open-source under the MIT licence and free to execute offline, independent of QR Code AI generation credits or paid plans.

napari setup and Barcode Scanner references

Refer to the official package listing and README for installation notes, limits and supported symbologies.