Using Perl and GD to generate QR codes

| No Comments
Google just deprecated their image chart API that I use to create QR codes.  When I first looked into it a while ago, there wasn't a good solution that worked on the old Perl I was stuck with.   Now I'm all upgraded and looked again and found GD::Barcode::QRcode.  Works great.

This is pretty straight from the module's synopsis, but it took a second for me to get what I wanted, so I thought I'd post it.

# Create QR code with Perl

use strict;
use warnings;
use GD::Barcode::QRcode;

open my $OUT, '>', 'test.png';
binmode($OUT);

my $gd = GD::Barcode::QRcode->new(
	'http://m.cindyruppert.com',  
	{ Ecc => 'L', Version=>2, ModuleSize => 16},
);

print $OUT $gd->plot->png;
close $OUT;

Leave a comment

About this Entry

This page contains a single entry by Bill Ruppert published on April 20, 2012 5:01 PM.

Load an Access database was the previous entry in this blog.

Basic HTTP Authentication, LWP::UserAgent and the Realm is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.38