Skip to main content

Create your own QR code using python.

 How to crate your own QR code and embed any link in it !

First of all thanks guys if you are reading this blog, in this blog we will be discussing about how to create our own Quick Response (QR) code and to for this small project we will be using Python Programming language since my blog is all about python 😁. 

Ok so before we dive into this project lets first understand a little about this QR code this thing what is this ? how it become so use full in modern world etc. etc. etc.  


What is QR code ?

A QR code is first invented by an Japanese automotive company named Denso Wave. After since it become so popular. Its because this image or in which it will be generated it can store a huge amount of data only in machine readable form. Its similarity matches to the barcode because both of them have black and white lines randomly in them. Using QR code we can track products, we can make easy payments, also can book our ticket online in one word it's safe to share information using the bar QR code. Generally if you guys don't know how a QR code looks like don't worry, here is how it looks like, and i also embedded my blog link in it so if you will scan (using any scanner) it will automatically open up the blog in your browser. Try it if you want ! and if not don't worry we will discuss it ahead in our blog.


QR code that I generated using python.

So how to use python to generate a QR code !

To do this we will use the QR code library of the Python.

So install it using pip install qrcode.

After installing the library import it "import qrocode". 

so the whole code looks something like this, 

import qrcode

data="https://pythonworkssolution.blogspot.com/2022/09/scrap-pdfs-using-python.htm"

qr_data=qrcode.QRCode(
    version=4,
    error_correction=qrcode.constants.ERROR_CORRECT_L,
    box_size=10,
    border=1
    )

qr_data.add_data(data)
qr_data.make(fit=True)
qr_gen = qr_data.make_image(fill_color="black", back_color="white")
qr_gen.save("blog.png")

So this is the whole code that will generate our QR code, you can make changes to this code as you for that
just play with this code a little. There not much in this code to tell you. As you can see there is a variable
named data. There i have given my blog link, if you want you can give any link there, not only link if you will
your that will be also appear in the browser, for more fun lets say you created an API and deployed it in
any cloud system and you have your website, then you can give that link also here and run the code, see
magic also if you want to make it an API for you we site you can do it using this code, for making API's python
has several frameworks you can use any of them if you want.

Do share this blog with others, it can be helpful for their school or college projects and also kids could get
idea about what QR code is! So this is all in this blog see you guys in my next blog.








Comments

Popular posts from this blog

Scrape PDF's using python

Hi, guys welcome to this blog post, i hope you guys are doing well. In this post i will discuss about how to scrape any specific text data or tables from PDF's and what kind of problems one can face while scrapping the PDF data.  The data trapped inside PDF are unstructured data and they can come from different sources like manually typed or system generated and depending on the source we have classified the PDF's into two categories  Simple or readable PDF's. Complex or scanned PDF's. Simple or readable PDF's: Simple PDF's can be of system generated or can come from data entry related sources and generally such kind of PDF's are less complicated and any kind of data can be easily extracted from such kind of PDFs.  Complex or scanned PDF's: On the other hand complex PDFs  or scanned PDFs are may come from system generated sources and generally are in scanned format and it is very difficult to handle the scanned PDFs and extracting data from it because so...

What is IoT (Internet Of Things)...???

This world has changed a lot, since the very beginning. Humans has made an significant development on this earth as compared to the other species. But it is not the thing that makes us so special on this earth, what makes us so special is the power of thinking that we have bestowed with. This is the thing that makes us so special on this planet earth. But are we humans really deserves this level of intelligence, although we have it naturally no doubt !!! For this... If we go back to the history and start digging our culture. how we survived from the great calamities, how we changed the world, how we developed our society, all the answers lies in it....!!! Biologically if we see every species on this is so well designed is to dominate the other species by making them on the top one but natures engineering is so perfect that it created a food chain, this food chain works so well that it maintains a perfect relationship between the apex ones and those species are at the bottom of the ...

All about data analysis and which programming language to choose to perform data analysis?

  What is data analysis ? Data analysis is the process of exploring, cleansing, transforming and modelling data in order to derive useful insight, supporting decision. Tools available for it ! There are two kinds of tools used in order to carry out data analysis: 1) Auto managed closed tools: These are the tools whose source code is not available, that is these are not open source. If you want to use these tools then you have to pay for them. Also, as these tools are not open source, if you want to learn these tools then you have to follow their documentation site. Though some auto managed tools have their free versions available.  Pros & Cons: Closed Source Expensive They are limited  Easy to learn Example: Tableau, Qlik View, Excel (Paid Version), Power BI (Paid Version), Zoho Analytics, SAS 2) Programming Languages: Then there are suitable programming languages which can derive the same result like auto managed closed tools.  Pros & Cons: These are open so...