talira

A library for creating and rendering QR codes into various formats

open sourceMITself-hostablefree

RQRCode is a Ruby library for creating QR codes and rendering them as SVG, as PNG (through ChunkyPNG) or as ANSI text for terminals. It takes the standard options: size, error correction level (L, M, Q or H) and number, alphanumeric or 8-bit byte mode, including several modes mixed in one code. The encoding lives in the dependency-free rqrcode_core gem, which can be used alone to get the module grid and draw it yourself. It was adapted in 2008 from Kazuhiko Arase's JavaScript QR code library, and Duncan Robertson maintains it.

Problems it solves

  • generate a QR code image for a URL in my Ruby on Rails app
  • put a QR code on a ticket, invoice or label as an SVG that scales cleanly
  • make a PNG QR code to attach to an email or a download in Ruby
  • print a scannable QR code in the terminal for a CLI login or device pairing
  • show a QR code users scan to set up their two-factor authentication app
  • pick the error correction level so a printed code still scans when it's scuffed
  • encode QR codes in pure Ruby without native image libraries
  • get the raw QR module grid and draw it myself in a PDF or on a canvas
  • change a QR code's colours and padding to match our brand
  • pack mixed numeric and text data into the smallest possible QR code

Features

  • SVG output (standalone or embeddable, rect or path, viewBox scaling, custom attributes)
  • PNG output through ChunkyPNG with sizing and border options
  • ANSI output for terminals
  • plain text output
  • error correction levels L, M, Q and H
  • number, alphanumeric and 8-bit byte modes
  • multi-segment encoding with mixed modes
  • automatic or fixed QR code size
  • rqrcode_core: pure-Ruby encoder with no runtime dependencies

Limitations

  • Doesn't read or decode QR codes: it only encodes them1

Capabilities

Has an APIplan not known