Skip to content

Latest commit

 

History

History
58 lines (45 loc) · 2.04 KB

0031-lispqr.org

File metadata and controls

58 lines (45 loc) · 2.04 KB

lispqr

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:

../../media/0031/qr-code.png

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