New development goes to QRCoders
Create QR Codes as data within Julia, or export as PNG.
Creating a QR Code couldn't be simpler.
julia> using QRCode
julia> qrcode("Hello world!")
29×29 BitArray{2}:
false false false false … false false false
false false false false false false false
⋮ ⋱
false false false false false false false
false false false false false false falseThe value true represents a dark space and false a white square.
There are two optional arguments: the error correction level (explained below) and compact which, when true, removes the white space around the code.
julia> qrcode("Hello world!", High(), compact = true)
25×25 BitArray{2}:
true true true true … true true true
true false false false false false true
⋮ ⋱
true false false false false false false
true true true true false false trueExporting files is also easy.
julia> exportqrcode("Hello world!")A file will be saved at ./qrcode.png.
There are three optional parameters.
julia> exportqrcode("Hello world!", "img/hello.png", Medium(), targetsize = 10, compact = true)This file will be saved as ./img/hello.png (if the img directory already exists), have a size of (approximately) 10 centimeters and be compact. Please note that compact codes may be hard to read depending on their background.
QR Codes and be encoded with four error correction levels Low, Medium, Quartile and High. Error correction can restore missing data from the QR code.
Lowcan restore up to 7% of missing codewords.Mediumcan restore up to 15% of missing codewords.Quartilecan restore up to 25% of missing codewords.Highcan restore up to 30% of missing codewords.
The four levels are encoded as types in QRCode.jl, grouped under the abstract type ErrCorrLevel. Don't forget to use parentheses when you call the values: qrcode("Hello", High()).
QR Codes can encode data using several encoding schemes. QRCode.jl supports three of them: Numeric, Alphanumeric and Byte.
Numeric is used for messages composed of digits only, Alphanumeric for messages composed of digits, characters A-Z (capital only) space and % * + - . / : \$, and Bytes for messages composed of ISO 8859-1 or UTF-8 characters. Please not that QR Code reader don't always support arbitrary UTF-8 characters.
QRCode.jl was built following this excellent tutorial.
QRCode.jl was created during the Efficient Scientific Computing with Julia workshop, taught by Valentin Churavy at the Okinawa Institute of Science and Technology in July 2019. Slides available here.

