2D barcode standards allow relatively large amounts of information (~7000 digits for a QR Code) in a small footprint. In addition, their unit cost is negligible compared to RFID tags so instead of just gracing the exterior of foodstuffs and UPS deliveries, they’re finding a host of wider applications in supply-chain management, advertising, e.t.c.

Media_httpuploadwikim_qgbel

I recently had to develop an internal letter tracking system for a client, so thinking QR Codes would be a cheap and quick solution to the problem of tracking real-world items, I started investigating Ruby implementations.

To start with, there’s a ruby port of libqrencode and the rQRcode gem which generates a text version of the code. The rQRcode gem generated 100 tags in approximately 50 seconds, not really quick enough to use in production.

My stopgap solution was to compile libqrencode:

and then just issue a system call in ruby when needed:

Generating 100 tags took just over 2 seconds this way. The system being developed just required a timely way of being able to pull the correct tag off the file system, so a 50x speedup was sufficient.

I may well post more on this in the near future; From what I’ve RTFM’ed it would be fairly trivial to write a ruby extension based on qrencode.h.