Skip to content

Commit

Permalink
the python code is now working perfectly, I have generated several QR…
Browse files Browse the repository at this point in the history
… codes for the Another Level client
  • Loading branch information
rnddave committed May 15, 2024
1 parent 0c4cb9c commit a122539
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 6 deletions.
Binary file added python-v1/another-level-logo-new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions python-v1/qrCodeGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
)

# Add the data to encode
qr.add_data('https://example.com')
qr.add_data('https://www.facebook.com/AnotherLevelscrapmetal')
qr.make(fit=True)

# Generate the QR code image
img = qr.make_image(fill_color="black", back_color="white")

# Open the logo image
logo = Image.open("logo.png")
logo = Image.open("another-level-logo-new.png")

# Calculate the size and position of the logo
logo_size = int(img.size[0] / 4)
logo_pos = ((img.size[0] - logo_size) // 2, (img.size[1] - logo_size) // 2)

# Create a styled QR code image
styled_img = StyledPilImage(img.size, back_color="white")
styled_img = StyledPilImage(img.size, back_color="white", fill_color="black")

# Add the QR code to the styled image
styled_img.paste_image(
Expand Down
Binary file added python-v3/AL-qr-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added python-v3/AL-qr-blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added python-v3/AL-qr-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added python-v3/AL-qr-red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added python-v3/al-logo-square.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added python-v3/anotherLevel-qr-code.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added python-v3/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions python-v3/qr-gen-v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def generate_qr_with_logo(url, logo_path, output_path):
# Calculate the size of the logo
qr_width, qr_height = qr_img.size
logo_size = qr_width // 5
logo = logo.resize((logo_size, logo_size), Image.ANTIALIAS)
logo = logo.resize((logo_size, logo_size), Image.Resampling.LANCZOS)

# Calculate the position to paste the logo
logo_pos = ((qr_width - logo_size) // 2, (qr_height - logo_size) // 2)
Expand All @@ -34,7 +34,7 @@ def generate_qr_with_logo(url, logo_path, output_path):

# Example usage
generate_qr_with_logo(
url='https://www.example.com',
logo_path='logo.png',
url='https://www.facebook.com/AnotherLevelscrapmetal',
logo_path='al-logo-square.png',
output_path='qrcode_with_logo.png'
)

0 comments on commit a122539

Please sign in to comment.