{"id":232,"date":"2025-05-25T19:11:01","date_gmt":"2025-05-25T19:11:01","guid":{"rendered":"https:\/\/r0b3rt.com\/andr-web\/?p=232"},"modified":"2025-05-25T19:11:01","modified_gmt":"2025-05-25T19:11:01","slug":"python-qr-code-generator","status":"publish","type":"post","link":"http:\/\/r0b3rt.com\/andr-web\/python-qr-code-generator\/","title":{"rendered":"Python &#8211; QR Code Generator"},"content":{"rendered":"<p><a href=\"https:\/\/www.essentialwidgets.com\/programs\/qr_code_generator.html\">BASE GENERATOR<\/a><\/p>\n<p><a href=\"https:\/\/www.essentialwidgets.com\/index_2.shtml\">Essential Widgets<\/a><\/p>\n<pre>import qrcode\r\nfrom PIL import Image\r\n\r\n# This QR  Code Generator was developed by Robert Andrews, Beatitudes Resident.\r\nxx = input(\"Enter URL:  \")\r\nxName = input(\"Enter QR Code File Name:  \")\r\n# Website URL\r\nwebsite_url = xx\r\n\r\n\r\n# ERROR TRAP URL\r\nxTRAP = xx[0:4]\r\nif xTRAP == \"http\":\r\n    website_url = xx\r\nelse:\r\n    website_url = \"http:\/\/\" + xx\r\n\r\n\r\n\r\n# ERROR TRAP FILENAME\r\nif xName.endswith(\".JPG\") or xName.endswith(\".PNG\"):\r\n    xName = xName\r\nelse:\r\n    xName = xName+\".JPG\"\r\n    \r\n\r\n\r\n# Create QR code instance\r\nqr = qrcode.QRCode(\r\n    version=1,\r\n    error_correction=qrcode.constants.ERROR_CORRECT_L,\r\n    box_size=10,\r\n    border=4,\r\n)\r\n\r\n# Add website URL to QR code\r\nqr.add_data(website_url)\r\nqr.make(fit=True)\r\n\r\n# Create an image from the QR code with dark blue color\r\nimg = qr.make_image(fill_color=\"#295BB3\", back_color=\"white\")  # Use hex code for dark blue\r\n\r\n# Open the logo image\r\nlogo = Image.open(\"LOGO.png\")\r\nlogo = logo.resize((59, 59))  # Resize the logo image if necessary\r\n\r\n# Get the position to paste the logo in the center of the QR code image\r\nposition = ((img.size[0] - logo.size[0]) \/\/ 2, (img.size[1] - logo.size[1]) \/\/ 2)\r\n\r\n# Paste the logo onto the QR code image\r\nimg.paste(logo, position)\r\n\r\n# Save the QR code image with the logo\r\nimg.save(xName)\r\n\r\nprint (\"QR Code is on the desktop under QR Code Generator.\")\r\n\r\n\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>BASE GENERATOR Essential Widgets import qrcode from PIL import Image # This QR Code Generator was developed by Robert Andrews, Beatitudes Resident. xx = input(&#8220;Enter URL: &#8220;) xName = input(&#8220;Enter QR Code File Name: &#8220;) # Website URL website_url = xx # ERROR TRAP URL xTRAP = xx[0:4] if xTRAP == &#8220;http&#8221;: website_url = xx &hellip; <a href=\"http:\/\/r0b3rt.com\/andr-web\/python-qr-code-generator\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Python &#8211; QR Code Generator&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-232","post","type-post","status-publish","format-standard","hentry","category-writing-code"],"_links":{"self":[{"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/posts\/232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/comments?post=232"}],"version-history":[{"count":1,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/posts\/232\/revisions"}],"predecessor-version":[{"id":233,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/posts\/232\/revisions\/233"}],"wp:attachment":[{"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/media?parent=232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/categories?post=232"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/tags?post=232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}