[ANN] QRCode.jl: Create QR Code within Julia

Hey, this is great! I needed this a few weeks ago, trying the #betterposter thing (which recommends using a QR code to link to further information).

Making SVG or PDF is easy enough:

using Luxor, QRCode

qrc = qrcode("https:/www.julialang.org")

@svg begin
    tiles = Tiler(250, 250, size(qrc)..., margin=0)
    squares = first.(tiles)
    for x in eachindex(qrc)
        if qrc[x]
            box(squares[x], tiles.tilewidth, tiles.tileheight, :fill)
        end
    end
end 250 250 "/tmp/qrcode"

I like the idea of pushing the graphics until the QR code is only just readable. This just about works:

qrc = qrcode("https:/www.julialang.org")

@svg begin
    tiles = Tiler(250, 250, size(qrc)..., margin=0)
    setline(0.5)
    squares = first.(tiles)
    @layer begin
        for (n, pt) in enumerate(box(O, 140, 140, vertices=true))
            sethue([Luxor.julia_purple, Luxor.julia_blue,  Luxor.julia_red,  Luxor.julia_green][n])
            circle(pt, 50, :fill)
        end
    end
    for x in eachindex(qrc)
        if qrc[x]
            sethue("black")
            box(squares[x], tiles.tilewidth, tiles.tileheight, :fill)
        end
    end
end 250 250 "/tmp/qrcode"

but I’m testing it on a screen - it might not be so reliable when printed out.

Nice package!

9 Likes