qrio – Low-level QR code decoding

Provides the QRDecoder object used for decoding QR codes. For more information about working with QR codes, see this Learn guide.


This module only handles decoding QR codes. If you are looking to generate a QR code, use the adafruit_miniqr library

Available on these boards
  • ATMegaZero ESP32-S2
  • Adafruit Camera
  • Adafruit Feather ESP32-S2 TFT
  • Adafruit Feather ESP32S2
  • Adafruit Feather RP2040
  • Adafruit FunHouse
  • Adafruit Grand Central M4 Express
  • Adafruit ItsyBitsy RP2040
  • Adafruit KB2040
  • Adafruit Macropad RP2040
  • Adafruit MagTag
  • Adafruit Metro ESP32S2
  • Adafruit QT Py ESP32S2
  • Adafruit QT Py RP2040
  • Adafruit QT2040 Trinkey
  • Arduino Nano RP2040 Connect
  • Artisense Reference Design RD00
  • BastWiFi
  • Challenger NB RP2040 WiFi
  • Challenger RP2040 LTE
  • Challenger RP2040 WiFi
  • CrumpS2
  • Cytron Maker Nano RP2040
  • Cytron Maker Pi RP2040
  • ESP 12k NodeMCU
  • ESP32-S2-DevKitC-1-N4
  • ESP32-S2-DevKitC-1-N4R2
  • EncoderPad RP2040
  • Feather ESP32S2 without PSRAM
  • FeatherS2
  • FeatherS2 Neo
  • FeatherS2 PreRelease
  • Franzininho WIFI w/Wroom
  • Franzininho WIFI w/Wrover
  • Gravitech Cucumber M
  • Gravitech Cucumber MS
  • Gravitech Cucumber R
  • Gravitech Cucumber RS
  • HMI-DevKit-1.1
  • HexKyS2
  • IoTs2
  • Kaluga 1
  • LILYGO TTGO T8 ESP32-S2 w/Display
  • MORPHEANS MorphESP-240
  • Melopero Shake RP2040
  • MicroDev microS2
  • Oak Dev Tech BREAD2040
  • Oak Dev Tech Cast-Away RP2040
  • Oak Dev Tech PixelWing ESP32S2
  • Pimoroni Badger 2040
  • Pimoroni Interstate 75
  • Pimoroni Keybow 2040
  • Pimoroni Motor 2040
  • Pimoroni PGA2040
  • Pimoroni Pico LiPo (16MB)
  • Pimoroni Pico LiPo (4MB)
  • Pimoroni PicoSystem
  • Pimoroni Plasma 2040
  • Pimoroni Servo 2040
  • Pimoroni Tiny 2040 (2MB)
  • Pimoroni Tiny 2040 (8MB)
  • PyKey 18 Numpad
  • PyKey 44 Ergo
  • PyKey 60
  • PyKey 87 TKL
  • RP2.65-F
  • RP2040 Stamp
  • Raspberry Pi Pico
  • S2Mini
  • S2Pico
  • Saola 1 w/Wroom
  • Saola 1 w/Wrover
  • Seeeduino XIAO RP2040
  • SparkFun MicroMod RP2040 Processor
  • SparkFun Pro Micro RP2040
  • SparkFun Thing Plus - RP2040
  • Targett Module Clip w/Wroom
  • Targett Module Clip w/Wrover
  • TinyS2
  • W5100S-EVB-Pico
  • Waveshare RP2040-Zero
  • nanoESP32-S2 w/Wrover
  • nanoESP32-S2 w/Wroom

class qrio.PixelPolicy
EVERY_BYTE :PixelPolicy

The input buffer to QRDecoder.decode consists of greyscale values in every byte

EVEN_BYTES :PixelPolicy

The input buffer to QRDecoder.decode consists of greyscale values in positions 0, 2, …, and ignored bytes in positions 1, 3, …. This can decode directly from YUV images where the even bytes hold the Y (luminance) data.

ODD_BYTES :PixelPolicy

The input buffer to QRDecoder.decode consists of greyscale values in positions 1, 3, …, and ignored bytes in positions 0, 2, …. This can decode directly from YUV images where the odd bytes hold the Y (luminance) data

class qrio.QRDecoder(width: int, height: int)

Construct a QRDecoder object

  • width (int) – The pixel width of the image to decode

  • height (int) – The pixel height of the image to decode

width :int

The width of image the decoder expects

height :int

The height of image the decoder expects

decode(buffer: circuitpython_typing.ReadableBuffer, pixel_policy: PixelPolicy = PixelPolicy.EVERY_BYTE) List[QRInfo]

Decode zero or more QR codes from the given image. The size of the buffer must be at least length``×``width bytes for EVERY_BYTE, and 2×``length``×``width`` bytes for EVEN_BYTES or ODD_BYTES.

class qrio.QRInfo

Information about a decoded QR code

payload :bytes

The content of the QR code

data_type :Union[str, int]

The encoding of the payload as a string (if a standard encoding) or int (if not standard)