I have gone through an interesting small size C code package for QR encoding at https://github.com/swex/QR-Image-embedded. Its logic is contained in two small files: QR_Encode.h (3.7KB) and QR_Encode.c (61KB). Then it is sun-shiny Saturday morning as I manage to add in-memory monochrome bitmap construction (1 bit per pixel) and wrap the whole package as PostgreSQL extension module. I share it at qrcode.tar.bz2.
Please modify PG_CONFIG = /opt/pgsql/9.4/bin/pg_config in Makefile as necessary. Then make and make install.
Connect to a database then invoke sql command
CREATE EXTENSION qr;
SELECT qr('QR Code with PostgreSQL', 0, 0, 4);
- Text to be encoded.
- Error correction level (0 to 3).
- Accepted model number (0 to 2).
- Scale 4 means: a dot in QR image will be 4 pixel width and 4 pixel height.