Nodes/MTB Nodes/Qr Code (mtb)
ComfyUI Node Runs on cloud

Qr Code (mtb)

The plain code that feeds those AI-art QR codes

By melMass·Created 3 years ago·Updated about a month ago· 721
Qr Code (mtb)
    • IMAGE
    urlhttps://www.github.com
    width256
    height256
    error_correctL
    box_size10
    border4
    invertfalse

    The description undersells it a bit: "Basic QR Code generator." True, but worth naming why this exact combination of a QR generator and ComfyUI is popular: it's the standard first step for the "QR code art" technique - feeding a plain black-and-white QR code into a ControlNet model trained specifically to hide it inside a generated image, so the final picture scans as a working QR code while looking like a landscape, a portrait, whatever your prompt describes. This node doesn't do that part. It just generates the plain code. The art happens downstream, once you wire this into a QR-code ControlNet.

    Inputs that matter

    • url (default https://www.github.com) - the data encoded into the code. Despite the name, this can be any text, not strictly a URL - that's just what the default demonstrates.
    • width / height (both default 256) - the output image dimensions.
    • box_size (default 10) - how many pixels wide each individual QR "module" (the small black/white squares that make up the code) renders as. This is a standard term from the Python qrcode library this kind of node is typically built on.
    • border (default 4) - the quiet-zone padding around the code, in modules. QR readers rely on this blank margin to detect where the code starts; shrinking it too far can hurt scannability.
    • error_correct (L, M, Q, or H, default L) - the QR spec's standard error-correction levels. L is the lowest redundancy and packs the most data per code; H is the most redundant and most tolerant of the code being partially obscured or damaged. This one matters a lot if you're feeding the output into a ControlNet for the "hidden QR art" technique - the AI-generated image is effectively "damaging" the code by overlaying art on top of it, so H gives the ControlNet the most room to work with while the code still scans reliably. L is fine if you just need a clean, undecorated code.
    • invert (a toggle, default off) - flips black and white in the output.

    Output is a single IMAGE - the generated code, ready to feed into a preview, a compositing step, or a ControlNet preprocessor pipeline.

    Installing it

    • ComfyUI Manager - search "MTB Nodes", install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/melMass/comfy_mtb, restart. A manual clone needs pip install -r requirements.txt run inside the comfy_mtb folder first.

    If you want the QR-art technique specifically, you'll also need a QR-code ControlNet model (a separate download, not something this node ships with) and the ControlNet nodes in your graph to apply it.

    Common issues & troubleshooting

    Final image doesn't scan after ControlNet runs. Raise error_correct to Q or H before you do anything else. L's low redundancy is the most likely reason a heavily-stylized generation stops scanning - there just isn't enough error-correction data left once the art has visually "damaged" much of the code.

    Code looks cramped or a scanner won't lock onto it at all. Check border - too thin a quiet zone is a classic reason phone cameras fail to even recognize there's a QR code present, independent of anything ControlNet does later.

    Output looks like a random block pattern, no obvious grid. box_size too small relative to width/height can make individual modules hard to distinguish, especially after any downstream resizing. Keep box_size proportionate to your target output size.

    Some mtb nodes fail to load at startup. Standard for this pack - check the console for [comfy_mtb] STATUS and http://127.0.0.1:8188/mtb for what didn't load. QR generation needs the Python qrcode library specifically; if that's missing from your environment, this is a plausible node to end up on the "didn't load" list.

    Categorymtb/generate

    Inputs (7)

    NameTypeDefaultDescription
    urlSTRINGhttps://www.github.com
    widthINT2560–8096
    heightINT2560–8096
    error_correctCOMBOL4 options: L, M, Q, H
    box_sizeINT100–8096
    borderINT40–8096
    invertCOMBOfalse1 options: BOOLEAN

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE