二维码生成
Make the pattern, let ControlNet make the art
- 二维码图片
- 遮罩层
QRCode ("二维码生成", QR code generator) renders a scannable QR code inside the graph and hands you both an image and a mask of its pattern. That's the boring half. The interesting half is what you do next with it: "ControlNet for QR Code" was the single highest-scoring ControlNet thread in the ecosystem's history, and the whole trick is generating an artistic image that still scans. This node is the starting point of that workflow - you generate the clean QR, feed it to a ControlNet as the conditioning image, and the model turns it into art while the pattern stays readable.
It's worth being clear about scope: this node does not make QR art. It produces a pristine, flat black-and-white QR. All the magic - the landscape that scans, the logo that's also a code - happens when you route that QR through a ControlNet (brightness or pattern conditioning) with a high control weight, or inpaint over it using the mask output.
How it works
It uses the standard Python qrcode library. Your text becomes the payload, and the four controls shape the rendering:
version(1–40) - the QR version, i.e. how many modules the code uses. Version 1 is the smallest. Don't stress about this; the library auto-bumps the version to fit the data, so think of it as a starting point.box_size- the pixel size of each module. Default 10. This is your resolution dial: bigger box, bigger image.border- the quiet zone around the code, in modules. Keep it at least 1; scanners want whitespace here.
One thing to know before you go hunting for it: the error-correction level is hard-coded to L (low). That's a real choice with a real consequence - low EC means a denser code for the same data, but less redundancy, so the pattern tolerates less overpainting. If your plan is aggressive art-on-top, you may want to generate the QR elsewhere with a higher correction level (like H) and feed that into the same ControlNet rig instead.
The inputs and outputs
text- whatever the code encodes: a URL, a string, a phone number.version,box_size,border- as above.- Outputs:
二维码图片(the QR as an IMAGE) and遮罩层(a MASK where the black modules are the mask). Wire the image into a ControlNet as your condition; the mask is there for inpainting around the pattern or building your own composite.
Installing it
In the ComfyUI_Lam pack. ComfyUI Manager, search "ComfyUI_Lam", or:
cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam
Restart, find it in the lam category. The only dependency it needs is the qrcode pip package, which is in the pack's requirements - a light, safe dependency that won't wreck your environment the way the pack's TensorFlow-era pins can. Skip the README's heavy install for this node; you don't need the face-fusion or inpainting models to make a QR.
Common issues
Keep the payload short if you want a small, low-version code - a version-1 QR holds only a couple dozen alphanumeric characters, and long URLs balloon the size. And remember the EC-level limitation above before you build an entire product on "just overpaint it."
The pack-level caveats apply as always: this is a Chinese-language pack with minimal community presence, and if you uninstall it later, delete ComfyUI/web/extensions/lam too - the frontend extension can leave a popup behind that survives the pack's removal. Also note that 2026-era QR control is an SD 1.5/SDXL game: no post-Flux ControlNet supports QR/brightness conditioning, so if you're on a modern base, generate on SDXL and carry the result forward. That's a quirk of the ecosystem, not of this node.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| version | INT | 11–40 | — |
| box_size | INT | 101–500 | — |
| border | INT | 11–10 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 二维码图片 | IMAGE | — |
| 遮罩层 | MASK | — |