Hex.pm Docs License

Pure Elixir QR code encoding — versions 1–20, error correction levels L/M/Q/H, byte mode. No external dependencies.

Part of the ExPDF umbrella.

Installation

def deps do
  [
    {:ex_qr, "~> 0.1"}
  ]
end

Usage

{:ok, matrix, size} = ExQR.encode("https://example.com")
{:ok, matrix, size} = ExQR.encode("Hello", :h)

The matrix is a map of {row, col} => 0 | 1 where 1 = black module.

Converting to rows

rows = ExQR.matrix_to_rows(matrix, size)
# => [[0, 1, 1, ...], [1, 0, 0, ...], ...]

Error correction levels

  • :l — Low (~7% recovery)
  • :m — Medium (~15% recovery, default)
  • :q — Quartile (~25% recovery)
  • :h — High (~30% recovery)

License

MIT. See LICENSE.md.