79441234

Date: 2025-02-15 09:09:49
Score: 0.5
Natty:
Report link

A bit late, but I was looking for the same, and at the end I had the following working for me:

# Importing library
import qrcode
from qrcode.image.styledpil import StyledPilImage
from qrcode.image.styles.colormasks import SolidFillColorMask

# Data to encode
data = "Data to encode"

# Creating an instance of QRCode class
qr = qrcode.QRCode(version = 2,
                   error_correction=qrcode.constants.ERROR_CORRECT_H,
                   box_size = 7,
                   border = 5)

# Adding data to the instance 'qr'
qr.add_data(data)

qr.make(fit = True)
img = qr.make_image(image_factory=StyledPilImage,
                    color_mask=SolidFillColorMask(front_color=(R,G,B)), #Put your color here
                    embeded_image_path="/content/Image.png")
img.save('MyQRCode2.png')
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Juanma