nohehf / qrpy

A QRcode generator library for python. In developpement, not production-ready.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

qrpy

*image generated by qrpy*

Context:

This was originally just built for a school projet, not meant to be a real python library. However, as i really liked to develop it, it has grown larger than expected.

Advantages :

Also, I think that this library has some advantages:

  • You can directly retrieve the pillow image object : .Im (for example to be able to modify it without having to save it locally).
  • You can directly retrieve the numpy array of the Qr code: .matrix
  • The qr.csv table and the constants FORMATBITS, VERSIONBITS and MASKS, gather all the information necessary to build a Qr code. So feel free to use it instead of searching the internet for hours as I did.

Limitations :

As the development is not very advanced, they are limitations to it, including (non-exhaustive):

  • Mask 4 seems broken, should be fixed soon
  • Not all versions have been tested, versions > 10 seems broken, have to find out where the error comes from
  • The qr code version is not automatically determined, so it must be chosen according to the data length. This is the very next feature.
  • The mask is not automatically determined.

How to use:

import Qr  
#To create a qr which contains 'github.com/nohehf/qrpy':  
qr = Qr(  
'github.com/nohehf/qrpy',  
mask=0,  
forceVersion=2,  
errorCorrectionLevel='L')  
qr.save(path) #saves the image to the specified path

qr.Im #The pillow Image of the Qr  
qr.matrix #The numpy array of the Qr  
qr.finalBits #The raw bits string encoded in the Qr, including error correction

Current version: v0

This version was realeasd now only because of my school project's deadline. This version is not production ready ! It lacks several features, and has a few bugs. Also, there is no real install at the moment, appart from cloning the repo, or dowloading it's archive.

Roadmap:

Planned additions:

  • Proper error handling
  • Auto version determination
  • Add scale parameter to the .save() method, to scale up the image.
  • .show() method to display the qr, in console or pop-up
  • Switch the "version" from dictionary to an object
  • Three methods of qr creation, .fromData(), .fromBytes() & .fromArray() to be able to create a qr code from those three datatypes
  • Add the other data formats
  • Auto mask determination

About

A QRcode generator library for python. In developpement, not production-ready.

License:MIT License


Languages

Language:Python 100.0%