roam/20220409212632-qr_codes.org
2022-04-09 22:46:46 -04:00

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/commit/e09e0fd972bd57f9dd7f7d8a2a11864800bc553a/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