Giter VIP home page Giter VIP logo

prashantkparth / qr_generator Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 7 KB

Generate a QR code and also Generate a red-and-white QR code using qrcode and PIL libraries to Convert the link to a QR code image and save it as '.png' for easy sharing and access. Customizable version, error correction, and visual styles ensure efficient and appealing output.

Python 100.00%
pyhon pyhton-3 qr-code-generator qr-generator qrcode-generator

qr_generator's Introduction

QR_Generator

Generate a QR code and also Generate a red-and-white QR code using qrcode and PIL libraries to Convert the link to a QR code image and save it as '.png' for easy sharing and access. Customizable version, error correction, and visual styles ensure efficient and appealing output.

Step-by-step explanation of the code:

  1. Importing Libraries: The code starts by importing the necessary libraries.

    • qrcode: This library is used for generating QR codes.
    • PIL (Python Imaging Library): This library is used for creating and manipulating images.
  2. Creating QR Code Generator Object:

    qr = qrcode.QRCode(version=1,
                       error_correction=qrcode.constants.ERROR_CORRECT_H,
                       box_size=10, border=4)

    Here, a QRCode object is created from the qrcode library. The parameters passed to the object have the following meanings:

    • version=1: Specifies the QR code version. In this case, it's version 1.
    • error_correction=qrcode.constants.ERROR_CORRECT_H: Sets the error correction level to high.
    • box_size=10: Defines the size of each box (or module) in the QR code.
    • border=4: Specifies the width of the border around the QR code.
  3. Adding Data to QR Code:

    qr.add_data("https://www.linkedin.com/in/prashant-kumar-parth-246245253")
    qr.make(fit=True)

    The add_data method is used to provide the data you want to encode in the QR code. In this case, it's a LinkedIn profile URL. The make method with fit=True is called to generate the QR code with the provided data.

  4. Generating QR Code Image:

    img = qr.make_image(fill_color="red", back_color="white")

    This code generates the QR code image using the make_image method. The fill_color parameter sets the color of the QR code modules (boxes), and the back_color parameter sets the background color.

  5. Saving the Image:

    img.save("LinkedIn_Prashant.png")

    Finally, the generated QR code image is saved as a PNG file named "LinkedIn_Prashant.png" in the current working directory.

In summary, this code snippet creates a QR code containing the provided LinkedIn profile URL and saves it as an image with red modules and a white background.

qr_generator's People

Contributors

prashantkparth avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.