DEV Community

Colten Jacob
Colten Jacob

Posted on

QPI — QR-Pixel Imaging

Turning QR Codes into Offline, Verifiable Image Files
Colten Jacob (2026)

Abstract

QR codes are universally deployed but are used almost exclusively as pointers (URLs, IDs, payment tokens). This paper introduces QPI (QR-Pixel Imaging), a method for encoding complete raster images directly inside standard black-and-white QR codes. QPI transforms QR from a redirection mechanism into a self-contained physical image file that can be scanned, verified, and rendered without network access. QPI does not modify the QR standard; it defines a data-layer format inside QR’s byte stream.

  1. Problem Statement

Modern QR codes function as indirections:
QR → URL → Server → Image / Menu / Ticket / Logo
This creates four fundamental problems:

  • Dependency on network access
  • Centralized control (link rot, content swapping)
  • No offline authenticity
  • No permanent data

A printed menu, ticket, or certificate can be photographed, but it cannot be:

  1. cryptographically verified
  2. programmatically compared
  3. versioned
  4. or authenticated

Meanwhile, QR codes already provide:

  • error correction
  • alignment
  • universal camera support
  • global infrastructure

Yet they are used only as links.

2. Core Idea

QPI inverts the model:
QR → Image Data → Display
Instead of pointing to an image, the QR code is the image.
The QR code becomes:

  • a physical file
  • a printable data blob
  • a machine-readable image

This enables:

  • offline menus
  • anti-tamper labels
  • identity photos
  • tickets
  • certificates
  • maps
  • diagrams with full error correction and zero servers.

3. Design Goals

QPI is designed to be:

  • Backward-compatible (works with any QR camera)
  • Deterministic (same QR → same image)
  • Offline
  • Robust to print damage
  • Machine-verifiable
  • Simple to implement

QPI does not change QR’s physical appearance.

4. Why Not Just Print the Image?

A printed image is for humans.
A QPI image is for machines.
A QPI image can be:

  • digitally compared
  • hashed
  • authenticated
  • stored
  • transmitted
  • translated
  • verified

A photograph of a poster cannot do this reliably.
QPI turns paper into a digital artifact.

5. QR Data Model (Important)

QR codes do not store ASCII.
They store bytes (0–255).
ASCII, UTF-8, URLs, and payment data are merely interpretations of those bytes.
QPI defines a new interpretation.

6. QPI File Format

QPI data is stored directly in QR’s byte stream.
All multi-byte values use big-endian order.

6.1 Header (first 8 bytes)

Bytes 0–2 → Magic string "QPI" (0x51 0x50 0x49) → identifies the data as QPI
Byte 3 → Version (0x01 for version 1)
Bytes 4–5 → Image width in pixels
Bytes 6–7 → Image height in pixels
This header allows any scanner to immediately detect a QPI image.

6.2 Color Mode (1 byte)

The next byte defines how to interpret the pixel data:
0x01 → Grayscale (8 bits per pixel)
0x02 → RGB / Truecolor (24 bits per pixel)
0x03 → Indexed-16 (4 bits per pixel)
0x04 → Indexed-256 (8 bits per pixel)

_6.3 Optional Palette (for indexed modes only)
_
If the color mode is indexed (0x03 or 0x04), the palette immediately follows the color mode byte.
Each palette entry = 3 bytes (Red, Green, Blue)
Indexed-16 → 16 entries → 48 bytes
Indexed-256 → 256 entries → 768 bytes

6.4 Pixel Data Stream

Pixels are stored left to right, top to bottom, row by row.
Grayscale → 1 byte per pixel
RGB → 3 bytes per pixel (R, G, B)
Indexed → palette index per pixel
This is the main image content of the QPI QR code.

7. Compression

QPI v1 allows optional compression (future-enabled):
Run-Length Encoding (RLE)
LZ-family codecs
Compression flags are reserved for later versions.

8. Error Correction

QPI relies entirely on QR’s built-in Reed-Solomon error correction.
This gives:

  • resistance to scratches
  • resistance to ink bleed
  • recovery from partial occlusion

No additional parity is required.

9. Capacity

A maximum-size QR (Version 40-L) holds ~3 KB of data.
This allows:

  • RGB: ~32×32 pixels
  • Grayscale: ~80×80
  • Black & White: ~200×200
  • Indexed logos: Much larger

Enough for:

  • logos
  • faces
  • tickets
  • maps
  • menus
  • fingerprints

10. Decoding Process

  1. Scan QR → extract bytes
  2. Check first 3 bytes = "QPI"
  3. Read width & height
  4. Read color mode
  5. Load palette (if any)
  6. Decode pixel stream
  7. Render image

11. This Is Not “Color QR”

Some proposals use colored QR squares to encode more bits per module.
That approach:

  • breaks under lighting changes
  • fails on cheap cameras
  • fails on printers

QPI keeps QR black-and-white and uses QR’s existing robustness.
QPI increases semantic density, not optical complexity.

12. Security Extensions
(Optional)

QPI supports adding:

  • digital signatures
  • SHA-256 hashes
  • timestamps

These can be appended after pixel data, allowing:

  • anti-forgery
  • authenticity verification
  • trusted visual documents

13. Applications

  • Offline restaurant menus
  • Anti-counterfeit labels
  • Product authentication
  • Tickets and passes
  • Government notices
  • Disaster information
  • Museum displays
  • Physical backups of digital images

14. Why QPI Is Novel

QPI converts QR from:
a link to data
into:
a container of data
This creates a new category:
physically portable digital images

For queries or discussions: coltenjacob2008@gmail.com

Related Post:

https://dev.to/colten_jacob_10ec3150930b/making-qr-codes-safe-by-design-a-trust-on-first-scan-model-tofsa-8-46i4

Top comments (0)