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

40 lines
1.1 KiB
Org Mode

:PROPERTIES:
:ID: ebc87e12-59d0-4241-a102-9ccce0fe56f5
:END:
#+title: QR Codes
* Generating in [[id:cda9c620-fec5-4549-b979-22fc06819d77][Python]]
#+begin_src python :results file
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"
#+end_src
#+RESULTS:
[[file:qrcode.png]]
* Avatar overlaid in center :ATTACH:
I stuck my [[id:a54fc4a6-4496-4f99-9c9d-c85481b65452][Phoenix]] avatar in the middle. The QR code remains useable, as enough
of the code remains visible behind it.
[[attachment:qrcode.png]]
- [[attachment:qrcode.xcf][XCF]]