Skip to content

info-sig/quirc-ruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quirc bindings for Ruby

Quirc is a small C library for extracting and decode QR codes from images. This project is a Ruby binding for that library with the library embedded.

Example

You have to supply a ChunkyPNG object or a binary string of the grayscale image with width and height.

require 'chunky_png'
require 'quirc'

img = ChunkyPNG::Image.from_file('path_to_image.png')
res = Quirc.decode(img).first
puts res.payload
require 'base64'
require 'zlib'
require 'quirc'

encoded = <<~EOD
  eJzt0kEOwyAMRNHe/9LpFo1mwK1IYqQ/mwQDfl5wXYQQQgghT+cziZ7Tb+Ue
  7vvurL76Vvvhvuvqu0jvqHoP9wx3dh73fHdWxz3Hrc5TvYfbx01RP83j7uH2
  cCtzuf+7g7uvr74ZrY9r967cedxebrrjZtK9tMbt4Y7+L/V/Tdzn3DRH+td5
  0hq3h5veR+qjNTcPbh+3Mpd7Qzt6497vat+Voe9Oa7j93GpdrXGt+7i9XO3j
  +jknzYB7huvmGM+7GXHPcWeOM3B7upV5Rlvvun3cHm6K+qt5qibucy4hhBBC
  yN58AXWDGDc=
EOD

img = Zlib::Inflate.inflate(Base64.decode64(encoded))
res = Quirc.decode(img, 120, 120).first
puts res.payload

License

This software is licensed under the MIT License. View the license.

About

QR decoder based on quirc

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 93.1%
  • Ruby 5.4%
  • Makefile 1.5%