Skip to content

Himanshu-Cyber-Code/QRlib

Repository files navigation

NOT READY NOW

QRlib

QRlib is an pure python qr code generator which can be used to create simple QR code , designer QR code or trackable QR codes

References

What is a QR Code?

A Quick Response code is a two-dimensional pictographic code used for its fast readability and comparatively large storage capacity. The basic QR code consists of black modules arranged in a square pattern on a white background. The information encoded can be made up of any kind of data (e.g., binary, alphanumeric, or Kanji symbols).

Installation

you can install QRlib with pip command

pip install QRlib

or with pip3

pip3 install QRlib

Requirements

Command Line Arguments

  • to update QRlib to latest version
    • python -m QRlib --update

    • python -m QRlib -u

  • to get help on module QRlib
    • python -m QRlib --help

    • python -m QRlib -h

Importing QRlib

import QRlib with command

from QRlib.QRlib import *

Generating QR codes

Classic QR
Classic QR
classic
from QRlib.QRlib import *

img_name = "ClassicQR" # name of Qr without extension of image ( default to png )
qr_data = "this is an classic qr" # content of qr
size = 200 # size in pixal ( optional )

qr.classic(qr_data, img_name, size=size)

Tansparent QR
Transparent QR
transparent
from QRlib.QRlib import *

img_name = "TransparentQR" # name of Qr without extension of image ( default to png )
qr_data = "this is an Transparent qr" # content of qr
img_url = "https://raw.githubusercontent.com/Himanshu-Cyber-Code/QRlib/master/images/QR_sample_QRlib/transparent_test.png" # url for the image ( optional )
size = 200 # size in pixal ( optional )

qr.transparent(qr_data, img_name, img=img_url, size=size)

Clear QR
Clear QR
clear
from QRlib.QRlib import *

img_name = "ClearQR" # name of Qr without extension of image ( default to png )
qr_data = "this is an Clear qr" # content of qr
size = 200 # size in pixal ( optional )

qr.clear(qr_data, qr_name, size=size)

Custom QR
CustomQR CustomQR CustomQR CustomQR CustomQR CustomQR CustomQR CustomQR CustomQR
Custom_1 Custom_2 Custom_3 Custom_4 Custom_5 Custom_6 Custom_7 Custom_8 Custom_9

And +1000 More Design`s

# An Minimum Example

from QRlib.QRlib import *

img_name = "CustomQR" # name of Qr without extension of image ( default to png )
qr_data = "this is an Custom qr" # content of qr

qr.custom(qr_data, qr_name)
# An Maximum Example

from QRlib.QRlib import *

img_name = "CustomQR" # name of Qr without extension of image ( default to png )
qr_data = "this is an Custom qr" # content of qr

qr.custom(
qr_data,
qr_name,
body=6,  # Pattern Of QR Body
frame=5,  # Eye Frame Pattern
bodyc7,  # QR Eye Ball Pattern
bodycolor=(17, 49, 81),  # Colour For QR Body
bgcolor=(255, 255, 255),  # QR Back Ground Colour
ballcolor=(17, 49, 81),  # QR Eye Ball Colour
framecolor=(17, 49, 81),  # QR Frame Colour
shadecolor=(17, 49, 81),  # Colour Of Other  Shade Which Will Be Mix With Body Colour
shadeonball=True,  # If Shade Has To Be Applied On Eye Balls of Qr
shadetype=0,  # Type Of shade From Linear Or Radial
logo='https://raw.githubusercontent.com/Himanshu-Cyber-Code/QRlib/master/images/QR_sample_QRlib/transparent_test.png',  # Logo On Qr ( URL )
size=200 # Size For Qr
)
Body Design No. Frame Design No. Ball Design No.
QRbody 0 QRframe 0 QRball 0
QRbody 1 QRframe 1 QRball 1
QRbody 2 QRframe 2 QRball 2
QRbody 3 QRframe 3 QRball 3
QRbody 4 QRframe 4 QRball 4
QRbody 5 QRframe 5 QRball 5
QRbody 6 QRframe 6 QRball 6
QRbody 7 QRframe 7 QRball 7
QRbody 8 QRframe 8 QRball 8
QRbody 9 QRframe 9 QRball 9
QRbody 10 QRframe 10 QRball 10
QRbody 11 QRframe 11 QRball 11
QRbody 12 QRframe 12 QRball 12
QRbody 13 QRframe 13 QRball 13
QRbody 14 QRframe 14 QRball 14
QRbody 15 QRball 15
QRbody 16 QRball 16
QRbody 17 QRball 17
QRbody 18
QRbody 19
QRbody 20
QRbody 21

Web QR
WebQR WebQRScreen
Web QR Link In QR
# Web QR are online And Can Be Used In Track Data To Get Trackable QR ( Details On Track Data Bellow )
from QRlib.QRlib import *

img_name = "WebQR" # name of Qr without extension of image ( default to png )
qr_data = ["line 1", "line 2", "line 3", "line 4", "line 5"] # content of web qr should be list of string each string represents line break ( maximum line is 5 )
tittle = "i am tittle" # tittle of the web page ( optional )

qr.web(qr_data, img_name, tittle=tittle)
fast_design QR

custom QR very hard to design every time because of their large options so there is the solution.

# Generate a json containing the design for custom QR with commannd
# And Use It In Future As A Template

from QRlib.QRlib import *

name = "json_file.json"
generate.json_custom(
name, 
body=6, 
frame=5, 
ball=7, 
bodycolor=(17, 49, 81), 
bgcolor=(255, 255, 255), 
ballcolor=(17, 49, 81), 
framecolor=(17, 49, 81), 
shadecolor=(17, 49, 81), 
shadeonball=True, 
shadetype=0, 
logo="", 
size=200,
)

To Use It

from QRlib.QRlib import *

json_file_path = r"C:/My/Path/To/json_file.json"

qr.fast_design(qr_data, img_name, json_file_path)

Types Of Data For QR

Data In QR Are In Special Formats Which Is Readable By QR Scanners. Some Can Be Generated By These Commands to use them place them in the qr_data fields of qr

Text Data
from QRlib.QRlib import *
data.text("Some Text")
URL Data
from QRlib.QRlib import *
data.url("https://example.com")

# if the url is much big then you can short it with adding a command short=True
data.url("https://example.com", short=True) # this will return a url some thing like https://is.gd/abcdef ( no matter how big is url )
Email Data
from QRlib.QRlib import *
email = "example@example.com"
subject = "i am the subject of email"
message = "i am the body of email"
data.email(email, subject = subject, message = message)
Phone Data
from QRlib.QRlib import *
phone_number = "+919998887766"
data.phone(phone_number)
SMS Data
from QRlib.QRlib import *
phone_number = "+919998887766"
message = "i am message for the sms"
data.sms(phone_number, message=message)
vcard Data

vcard are use in two versions to specify the version use command data.vcard2 or data.vcard3

from QRlib.QRlib import *

first_name = "First_Name"

data.vcard2(
firs_tname, 
lastname="Last_Name",                #( optional )
position="my position",              #( optional )
work="Job",                          #( optional )
org="my Organization",               #( optional )
website="https://example.com",       #( optional )
email="example@example.com",         #( optional )
phone="+918887776655",               #( optional )
homephone="+913332225577",           #( optional )
workphone="+912223336655",           #( optional )
homefax="56282",                     #( optional )
workfax="53794",                     #( optional )
city="MyCity",                       #( optional )
state="MyState",                     #( optional )
country="MyCountry",                 #( optional )
zipcode="836619",                    #( optional )
street="MyStreet",                   #( optional )
)
Location Data
from QRlib.QRlib import *
Latitude = 4637368
Longitude = 4827636
data.location(Latitude, Longitude)
Wifi Data
from QRlib.QRlib import *
wifi("ssid", "password", encryption=0) # 0='nopass' , 1='WPA' , 2='WEP'
Event Data
from QRlib.QRlib import *

tittle = "Event Tittle"
location = "My Location"

data.event(
tittle, 
location=location, 
start=[2020,6,16,11,54], # default is current time (start time of event) ([year,month,date,hour,minute])
end=[2020,6,16,11,54], # default is current time (end time of event) ([year,month,date,hour,minute])
)
Mecard Data
from QRlib.QRlib import *

First_Name = "FirstName"

mecard(
First_Name, 
lastname="lastname", 
nickname="Nick Name",                   #( optional )
email="Email@Email.com",                #( optional )
phone1="+5366647168",                   #( optional )
phone2="+474725367158",                 #( optional )
phone3="+467835357471",                 #( optional )
dob=[2020,6,16], #(year,month,date)     #( optional )
note="a short note",                    #( optional )
city="city",                            #( optional )
state="state",                          #( optional )
country="country",                      #( optional )
zipcode="536829",                       #( optional )
street="MyStreet",                      #( optional )
)
Host data

this is a special type of data which can be use to put upto 100GB of data in a QR for this you just need a email account

STEPS :-

  • make a gmail account
  • you will get 15GB of free space on google drive
  • on google drive make a folder named QRlib
  • now upload the file(images,APK,pdf,etc) which you want to put in QR
  • then write the following command
  • they will get hosted on internet with a direct URL which will be put in QR
from QRlib.QRlib import *
email = "example@example.com"
file = "QRlib.png"
data.host(email ,file)
Trace URL data
from QRlib.QRlib import *
url = "https://example.com"
data.trace(url, action=1)
# action = 1 will generate a url with a suffix https://is.gd/ which can be traced in future

to trace the url generated above use action = 0

from QRlib.QRlib import *
url = # the url generated above
data.trace(url ,action=0)
# this will return a url which will contain the statistics of the given url

ISSUES

If any issues are seen in this module then feel free to tell us at Our GitHub Page

License

MIT
MIT License

Copyright © 2020 Himanshu Jha

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "software"),
to deal in the Software without restriction, including without limitation the 
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

THIS MIT LICENSE DOES NOT INCLUDE T&C FOR THE API(s), OTHER PYTHON MODULE(s)
AND SOFTWARE(s) USED IN THIS SOFTWARE

Version Info

Version 1.0.0

  • Simple QR
  • custom QR
  • trackable QR
  • Web QR
  • video QR
  • Web Support
  • Github support
  • Local images support
  • live tracking

GO TO TOP

About

QRlib python module home site

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published