roam/20220409212632-qr_codes.org

1.1 KiB

QR Codes

Generating in Python

  import qrcode
  from qrcode.image.styledpil import StyledPilImage
  from qrcode.image.styles.moduledrawers import RoundedModuleDrawer
  from qrcode.image.styles.colormasks import SquareGradiantColorMask

  qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_H)

  center = (166, 33, 0, 255)
  edge = (0, 86, 224, 255)

  qr.add_data("https://correl.github.io")
  img = qr.make_image(
      image_factory=StyledPilImage,
      module_drawer=RoundedModuleDrawer(),
      color_mask=SquareGradiantColorMask(
          back_color=(255, 255, 255, 0),
          center_color=center,
          edge_color=edge
      ),
  )
  img.save("qrcode.png")
  return "qrcode.png"

/correlr/roam/media/branch/main/qrcode.png

Avatar overlaid in center   ATTACH

I stuck my Phoenix avatar in the middle. The QR code remains useable, as enough of the code remains visible behind it.

attachment:qrcode.png