QR Code decoder for Ruby
Switch branches/tags
Nothing to show
Clone or download
rubysolo Merge pull request #2 from sameera207/master
error fixed when no annotate options given, moved option evaluation to ...
Latest commit bff1f01 Mar 28, 2014



QRio is a QR code decoder for Ruby


QRio can extract QR contents in one step:

require 'qrio'
puts Qrio::Qr.load("some-image.png").qr.text

If you know / are curious about the decoding process, QRio can generate an image illustrating the intermediate steps to decoding:

require 'qrio'
qr = Qrio::Qr.load("some-image.png")

  :crop => true,      # crop output image to detected QR bounds
  :annotate => [
    :finder_patterns, # outline detected finder patterns
    :angles           # draw lines connecting finder pattern centers


  • Ruby 1.9.2 (will be backported to 1.8.7)
  • ChunkyPNG (tested with version 1.2.0)


NOTE : QRio is not yet fully functional. If you'd like to help out, fork and submit a tested pull request. :)


  • support numeric / alphanumeric / kanji mode QR codes
  • refine alignment pattern location and adjust module sampling grid accordingly
  • error correction support
  • support more image formats (limited to PNG at the moment)
  • native thresholding for input images
  • support more QR versions
  • speed improvements

Does anything work?

Yeah, it's coming along. Here's what should be working now:

  • find and extract a QR code from an image. I've been cheating somewhat, using image magick to threshold the image for me:

    convert raw.jpg -colorspace Gray -lat 90x90-3% -median 1x1 cooked.png
  • detect and correct orientation of extracted QR

  • extract modules via a sampling grid

  • extract raw bytes from data / error correction blocks

  • de-interlace blocks into final bitstream

  • extract text from bitstream (ascii mode only)