top of page

Python | QR-Code

Oct 27, 2021
1 min read

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 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.


A QR code generator written purely in Python with SVG, EPS, PNG and terminal output.


The pyqrcode module is a QR code generator that is simple to use and written in pure python. The module can automates most of the building process for creating QR codes. Most codes can be created using only two lines of code!

Unlike other generators, all of the helpers can be controlled manually. You are free to set any or all of the properties of your QR code. QR codes can be saved as SVG, PNG (by using the pypng module), and plain text. They can also be displayed directly in most Linux terminal emulators.


PyPNG is pure Python and has no dependencies. It requires Python 3.5 or any compatible higher version.


Requirements:

pip install pypng
pip install pyqrcode
pip install qrcode[pil]

#1 Example:


Using Linux:

import pyqrcode
url = pyqrcode.create ('https://www.stenge.info')
url.svg ('stenge-url.svg', scale = 8)
url.eps ('stenge-url.eps', scale = 2)
print (url.terminal (quiet_zone = 1))

Looks like this:

#2 Example:


Using PyCharm:

import pyqrcode
import png
from pyqrcode import QRCode
s = str(input("Enter URL: "))
name = str(input("Enter Website Name: "))
url = pyqrcode.create(s)
url.png(name+".png", scale = 6)

Looks like this:



Recent Posts

See All
Hiding Messages Inside an Emoji

Imagine receiving a message that contains nothing more than this: 🌊‌‌‌‌‌‌‌‌‌‍‌‍‍‌‍‍​‌‌‌‌‌‌‌‌‌‍‌‍‌‌‍‍​‌‌‌‌‌‌‌‌‌‍‌‍‌‍‌‌​‌‌‌‌‌‌‌‌‌‍‌‌‌‍‌‍​‌‌‌‌‌‌‌‌‌‍‌‌‍‍‍‌​‌‌‌‌‌‌‌‌‌‍‌‌‌‍‍‍​‌‌‌‌‌‌‌‌‌‍‌‌‌‍‌‍​‌‌‌‌‌‌‌‌‌‌‍‌‍

 
 
 
Fake Data in Python

If you are developing applications, testing your software, or just exploring Python's capabilities, you might have faced a situation...

 
 
 
Mobile | Secret Phone Codes

Our smartphones have become extensions of ourselves, facilitating much of our communication and storing troves of private data. If...

 
 
 

Comments


STENGE.info | Built with curiosity. Secured by knowledge.

bottom of page