Ruby创建QR码

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

require 'rubygems'
require 'rqrcode'
require 'qr_image'

# QR Code parameters
text = 'This is a test'
size = 4
level = 'h'
 
# Produce the QR Code
qr = RQRCode::QRCode.new(text,  :size => size, :level => level)
 
# Create the image and double its size
img = QRImage.new(qr).sample(6)
 
# Write image to disk
img.write('./qr.png') { quality = 100 }