Skip to content

Implement Micro QR Code (M1-M4) #2

@productdevbook

Description

@productdevbook

Context

Micro QR codes are increasingly requested for space-constrained applications (packaging labels, small components). While no single competitor issue tracks this, the demand comes from the broader barcode ecosystem and users of libraries like bwip-js that support it.

Description

Micro QR Code is a compact variant of QR Code defined in ISO/IEC 18004 Annex C. It uses a single finder pattern (vs. three in standard QR) and supports versions M1-M4 with sizes from 11x11 to 17x17 modules. It is ideal for very small labels where a full QR code would be too large.

Current Status in etiket

The types and stubs already exist in src/encoders/qr/micro.ts:

export function encodeMicroQR(_text: string, _options?: MicroQROptions): boolean[][] {
  throw new Error("Micro QR Code is not yet implemented");
}

The QRCodeOptions interface has a micro?: boolean field, but it is not wired up.

Proposed Solution

  1. Implement the Micro QR encoding algorithm in src/encoders/qr/micro.ts:
    • M1: Numeric only, no EC
    • M2: Numeric + Alphanumeric, EC L/M
    • M3: Numeric + Alphanumeric + Byte + Kanji, EC L/M/Q
    • M4: All modes, EC L/M/Q
  2. Single finder pattern placement (top-left only)
  3. Micro QR specific format information encoding
  4. Wire up the micro option in the main encodeQR function
  5. Export encodeMicroQR from the public API
  6. Add a dedicated microqr() convenience function or respect the micro: true option

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfrom-competitorFeature inspired by competitor libraries

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions