zcaudate-me / qrcode Goto Github PK
View Code? Open in Web Editor NEWThis project forked from desertmonad/qrcode
qrcode generator in clojure
This project forked from desertmonad/qrcode
qrcode generator in clojure
# qrcode a qrcode generator in clojure I was curious how qrcode generation worked so I decided to download the specification pdf and start from scratch with clojure. This codebase 'works' but I KNOW the scoring/selection for each mask that can be applied to the qrcode is not yet right. Specifically the algorithm that scores the blocks of similar color (white/black) needs attention. See the spec for details and feel free to reach out to me if you have a cool implementation for the scoring. :-) Also, keep in mind, the goal was NOT to write a 'better/faster/cooler' qrcode encoder than what is already out there. The goal was to simply understand the process and write it in clojure using sequences and a (hopefully) clojure-esque style. There are lots of places where the code can be improved to be more efficient/faster. BUT you can watch a qrcode being assembled along the way by examining the data-map that is produced at each step IF you are interested. Each step returns a map with more added to it so you can monitor what is going on. Also, it does not do the kanji encoding (but it would not be hard to add). It only does numeric, alphanumeric, and 8-bit-byte modes. If you need to generate qrcodes in your code, you are probably better served with one of the supported java libraries that do WAY more than this one (see http://code.google.com/p/zxing/) However, if anyone is interested in trying to make this more usable in production, let me know ... it might be fun. ## Usage The main function is 'encode'. It takes the message to encode and the error correction level as a keyword (:L :M :Q or :H): (requre '[qrcode.core :as qrc]) (-> (qrc/encode "http://github.com" :L) (qrc/draw) (qrc/save-as "/tmp/qrcode")) This would generate a file /tmp/qrcode.png that you should be able to read with your reader. I know the scoring and selection of the mask is not right but it does work. The image is generated with 5 px square regions per bit. The qrc/encode function handles calling each function necessary to make a qrcode but you could call them manually and see the resulting map to see what is happenning. See the function definition to see each step. ## Things to do fix the scoring/selection of masks enhance it to allow different image types (currently only .png) add kanji mode add optimizations to allow mixed modes add colors and other embellishments? add options for image sizing add a decoder? ## License Copyright (C) 2011 pupcus Distributed under the Eclipse Public License, the same as Clojure.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.