Create QR Code
A QR Code Straight Out of Your Graph (No Website, No API Key)
- IMAGE
Create QR Code does exactly what the name says: you type a URL or any text, and it hands back a QR code as a ComfyUI IMAGE tensor. No website, no API, no API key - it's all generated locally in the graph. The immediate question is why you'd want that inside ComfyUI at all, and the honest answer is QR art.
The "QR Monster" style - feeding a QR code as a ControlNet condition (brightness/pattern based) so the model draws art over it while keeping it scannable - was one of the highest-engaged ControlNet techniques of the SDXL era. If you're building one of those workflows, this node is the cleanest way to generate the condition image without leaving the graph or pasting a QR from a random website. Fair warning: as of this writing there's no working QR ControlNet for post-Flux models - QR Monster never got ported past SDXL - so this pairs with an SD 1.5 or SDXL pass, or with plain compositing a scannable code onto a poster. It's also just handy for embedding a real code into marketing-style generations.
How it works
Under the hood it uses the pyqrcode library to build the code, renders it to PNG in memory (pypng), loads that with PIL, and converts it to a float tensor via torchvision's ToTensor(). The heavy machinery - PIL, torchvision - already ships with ComfyUI, so the pack only needs two tiny pure-Python packages to add.
The inputs that matter
Only content is required - your URL or text. Everything else has a sane default, and three of them are worth touching:
error(L/M/Q/H) - the error-correction level. The default is L, which is the weakest. For QR art, where ControlNet is going to smear the pattern, bump it to Q or H or your code will stop scanning entirely. L recovers ~7% of damage, Q ~25%, H ~30%.scale- pixels per module. Default 5 produces a small image; raise it if you're feeding a big canvas.quiet_zone- the white margin scanners need around the code. Default 4 modules is the spec; leave it alone unless you genuinely don't care about scanning.
The color inputs (module + background, each with RGBA) let you pre-tint the code, and version 1–40 trades density for capacity - keep the default and let pyqrcode pick. mode defaults to binary, which is right for URLs.
Wiring the output
One output: IMAGE. Straight into a preview, an image-scale node, a LatentComposite to drop it on a canvas, or straight into a ControlNet preprocessor as the condition. One gotcha from the implementation: because it's built with ToTensor(), the tensor comes out channel-first with no batch dimension, which isn't the BHWC shape most ComfyUI nodes expect. If a downstream node throws a shape error, run the output through an image-resize/convert node first - that normalizes it.
How to install
Same as the rest of the pack. In ComfyUI Manager, search ComfyUI-Calculation and install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Limitex/ComfyUI-Calculation
Then restart. Manager handles the pip deps for you; if you cloned manually, pip install -r requirements.txt (it's just pyqrcode and pypng). No models to download.
Common issues & troubleshooting
- Code won't scan. First suspect is error-correction level L - raise it. Second is
quiet_zoneset to 0, or a white-on-dark color inversion. Always test with your phone before committing to the workflow. - Shape errors downstream. That's the channel-first tensor above; normalize it through a resize node.
- Content too long for the version. pyqrcode will bump the version automatically, so this rarely bites unless you force a tiny
versionwith a huge string.
If you're making QR art, remember the ControlNet needs a high control weight and a strong aesthetic prompt - the QR holds the structure, the model supplies the art.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| content | STRING | — | |
| erroropt | COMBO | L | 4 options: L, M, Q, H |
| versionopt | INT | 31–40 | — |
| modeopt | COMBO | binary | 4 options: numeric, alphanumeric, kanji, binary |
| encodingopt | STRING | iso-8859-1 | — |
| scaleopt | INT | 5 | — |
| module_color_Ropt | INT | 00–255 | — |
| module_color_Gopt | INT | 00–255 | — |
| module_color_Bopt | INT | 00–255 | — |
| module_color_Aopt | INT | 2550–255 | — |
| background_Ropt | INT | 2550–255 | — |
| background_Gopt | INT | 2550–255 | — |
| background_Bopt | INT | 2550–255 | — |
| background_Aopt | INT | 2550–255 | — |
| quiet_zoneopt | INT | 4 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |