先日Railsの画面にQRコードを表示するサンプルはつくったんだけど、いかんせん出力がHTML+CSSなので汎用性に欠ける。 QRの画像データを出力する物で使いやすいのはないかな、と探してみたんだけど見当たらなかったのでRMagickで作ってみた。 例によって作成した時点の環境は以下の通り。 Ruby 1.8.7 P160 rqrcode 0.3.2 rmagick 2.9.2 ImageMagick @6.4.4-3_0+q16 (MacのPortインストール) 以下が作成したモジュール require "rubygems" require "rqrcode" require "rmagick" module QRImage include Magick def create_qr(str,opt={}) # コード作成用定数 opt[:size] ||= 4 opt[:level] |