These four tools are used to generate QR codes in large batches. The QR codes encode a url. The QR codes can be laid out on a page, ready to be printed out onto sticker sheets or labels.
All the tools display a help message when invoked with the -h
or
--help
option.
Contents:
Generating QR codes: bug and getqr
Preparing QR codes for printing: qrlabeller and labelprint
Summary: you can generate a list of URLs using the bug
tool. Each of
the URLs in this list can be encoded into a QR code using the getqr
tool.
There are no configuration files for these tools; their behaviour is specified on the command line.
(written in Ruby)
bug
(batch url generator) generates a list of urls that can later be
encoded into QR codes. Each URL in the list consists of a base URL that
is the same for all URLs in the list, and an ID that increments for
each URL. An example output of bug
is
http://www.google.com/01
http://www.google.com/02
...
http://www.google.com/99
where the base URL is http://www.google.com/
Note the slash at the end;
bug
doesn't automatically put a slash at the end of the URL if you
don't provide one.
The start and end IDs can be specified with the -s
and -e
options. If
the start ID has fewer digits than the end ID, then some of the IDs will be
padded out with zeroes. (See the example above: note the id 01
). If this
behaviour is not desired, you can disable it with the --no-lead-zeroes
flag.
The base URL can be changed with the -u
option. By default, it points
to Google's UK homepage.
bug
writes it's output to stdout; you can redirect it to a file.
Example:
./bug -s 0 -e 49 -u http://foo.bar.baz/ > urls.txt
writes this output to urls.txt
:
http://foo.bar.baz/00
http://foo.bar.baz/01
...
http://foo.bar.baz/48
http://foo.bar.baz/49
(written in Ruby)
getqr
is used to generate QR codes from a list of strings, such as the
one produced by bug
. When given a file containing a list of strings,
qetqr
will encode each string as a QR code and write the QR codes to an
image.
getqr
takes a single argument -- a file containing a newline-delimited
list of strings, which can be URLs. The -d
option specifies the
directory where QR codes should be saved; the directory should already
exist. The -s
option specifies the length of the side of the QR code, in
pixels. (QR codes are always sqare). The size defaults to 400px.
getqr
saves the QR codes as PNG files. The name of the file is the same
as the ID generated by bug
, i.e. the last sequence of digits in the
string. If getqr
is given the file generated by the example for bug
above, it will generate images 00.png
through to 49.png
.
Example:
./getqr -d /tmp/images -s 512 urls.txt
Encodes all the urls in urls.txt
as 512x512px QR codes and writes them
to /tmp/images
as PNG files.
Summary: you can place a QR code on a rectangular label, with a numeric
ID printed beside the QR code, using the QrLabeller
tool. You can then
arrange several of these labels onto a single image which is formatted to
print nicely onto a sticker sheet, such as Avery Address Labels. This is
done using the LabelPrint
tool.
These two tools use an XML configuration file, located in the config
directory. The file is called currentLayout.xml
, and it can be
validated using pageLayout.dtd
. The configuration file specifies the
layout of the page you would like to print on (such as Avery Address
Labels), and also describes the layout of each individual label (the
position of the QR code, the size of the id label, etc). You can modify
currentLayout.xml
to suit a different format of sticker sheet,
but don't forget to back it up, e.g. as
averyAddressLabel.xml
.
(Written in Java). Should be invoked using the shell script
qrlabel
.
QrLabeller
adds a numeric label to each image in a directory. It is
intended to label QR codes generated by getqr
, so it expects each image
to be named XXX.png
, where XXX
is a (fixed or variable width) number.
QrLabeller
creates some white space to the side(s) of the QR code, and
then writes a numeric label in this white space. The contents of the label
will be XXX
(the filename, minus the .png extension). The exact layout
and shape of the label is specified in the configuration file
currentLayout.xml
in the config
directory.
QrLabeller
will try to
label every file in the directory it is given; if some of the files are
not images, bad things may happen.
Example:
./qrlabeller /tmp/images
Applies a label to every file in /tmp/images
, overwriting the original
image.
QrLabeller
can be compiled using the compile
script.
(Written in Java). Should be invoked using the shell script
labelprint
.
LabelPrint
lays out many QR codes onto a page layout that is suitable for
printing onto sticker sheets or labels. It takes a directory of QR code
images and outputs several JPEG images, each of which contains several QR
codes laid out correctly. The output will be named PageX.jpg
, where X
is a number that increments starting at 1.
LabelPrint
reads the page layout from the configuration file
currentLayout.xml
in the config
directory. Thus, in order to change
the page layout, you simply need to modify this file; no recompilation is
necessary. The layout provided corresponds to the format of Avery Address
Labels; you should keep a backup of that layout if you decide to change
currentLayout.xml
.
Note that LabelPrint
processes every file in the directory given to it.
If some of the files are not images, bad things may happen. The output is
saved in the same directory as the imput, so if you run it twice, the
output of the first invocation will be treated as part of the input to
the second invocation -- you probably don't want this.
LabelPrint
expects every image that it processes to be in the correct
shape for printing onto the label; it simply lays images out, it does not
reshape them. If the input images (eg. generated by QrLabeller
) are the
wrong shape, the output won't be pretty.
Example:
./labelprint /tmp/images
Lays out every QR code in /tmp/images
onto sheets named Page1.jpg
,
Page2.jpg
... which are saved in /tmp/images
.
LabelPrint
, and associated PageLayouts, can be compiled using the
compile
script.