Created
February 10, 2023 06:50
-
-
Save R3DHULK/295a32d208b9316fbc796cb666e0dd8b to your computer and use it in GitHub Desktop.
QR Code Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pip install qrcode | |
import qrcode | |
def generate_qr_code(data, filename): | |
qr = qrcode.QRCode( | |
version=1, | |
box_size=10, | |
border=5 | |
) | |
qr.add_data(data) | |
qr.make(fit=True) | |
img = qr.make_image(fill_color="black", back_color="white") | |
img.save(filename) | |
# Example usage | |
generate_qr_code("Hello, QR code!", "hello_qr.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment