RSS Feed

Lisp Project of the Day

lispqr

You can support this project by donating at:

Donate using PatreonDonate using Liberapay

Or see the list of project sponsors.

lispqrgraphics

This small library is able to generate standard QR codes.

It produces either a matrix, which you can render on your own:

POFTHEDAY> (mare5x.lispqr.encode::encode->matrix
              "Hello Lisp World!")
#2A((1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1)
    (1 0 0 0 0 0 1 0 1 1 0 1 1 0 1 0 0 0 0 0 1)
    (1 0 1 1 1 0 1 0 0 1 0 0 1 0 1 0 1 1 1 0 1)
    (1 0 1 1 1 0 1 0 1 1 1 1 0 0 1 0 1 1 1 0 1)
    (1 0 1 1 1 0 1 0 0 1 0 0 0 0 1 0 1 1 1 0 1)
    (1 0 0 0 0 0 1 0 1 0 0 1 1 0 1 0 0 0 0 0 1)
    (1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1)
    (0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0)
    (1 1 1 1 1 0 1 1 1 1 0 0 1 1 0 1 0 1 0 1 0)
    (0 1 0 1 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1)
    (0 1 1 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 1 1 0)
    (0 0 1 0 0 1 0 0 1 0 1 1 0 1 0 1 0 1 1 0 0)
    (1 0 1 1 1 0 1 1 0 0 0 1 0 1 1 0 1 0 0 0 1)
    (0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0)
    (1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0)
    (1 0 0 0 0 0 1 0 0 0 0 1 0 1 0 1 0 1 1 1 0)
    (1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 0 0 0 0)
    (1 0 1 1 1 0 1 0 1 1 1 1 1 0 0 1 1 1 0 1 0)
    (1 0 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 0 1 0 0)
    (1 0 0 0 0 0 1 0 1 1 0 0 1 0 0 0 1 1 1 0 0)
    (1 1 1 1 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 1 0))

Or it can render the image into a png (internally, it uses @xach's "zpng", used in my previous post to render a frame from the GIF file):

POFTHEDAY> (mare5x.lispqr.encode::encode->image
             "http://40ants.com/lisp-project-of-the-day/"
             "docs/media/0031/qr-code.png")
Encoding "http://40ants.com/lisp-project-of-the-day/"
Version 3
Error correction level M
Encoding mode 8-BIT-BYTE
Mask-number -1
/Users/art/poftheday/docs/media/0031/qr-code.png

Here is the result:

Symbols "encode->image" and "encode->matrix" are not external yet, but I've created the pull request to fix it.


Brought to you by 40Ants under Creative Commons License