Nodes/ComfyUI-Simple_QR_Codes/πŸ›°οΈ QRCodes (Simple Style)
ComfyUI Node

πŸ›°οΈ QRCodes (Simple Style)

The QR code that dresses up

By zentrocdotΒ·Created 2 years agoΒ·Updated 2 years agoΒ· 2
πŸ›°οΈ QRCodes (Simple Style)
    • IMAGE
    • MASK
    • INVERTED_MASK
    β—„textβ–Ί
    β—„width512β–Ί
    β—„height512β–Ί
    β—„bg_color(0, 0, 0)β–Ί
    β—„fg_color(255, 255, 255)β–Ί
    β—„error_correctβ–Ύβ–Ί
    β—„versionβ–Ύβ–Ί
    β—„box_size10β–Ί
    β—„border4β–Ί
    β—„radius0β–Ί
    β—„styleβ–Ύβ–Ί
    β—„colorβ–Ύβ–Ί
    β—„color_1st(255, 255, 255)β–Ί
    β—„color_2nd(255, 0, 0)β–Ί
    β—„color_3rd(255, 0, 255)β–Ί
    β—„mask_colorβ–Ύβ–Ί

    The show-off of the qrcode family

    QRCodes (Simple Style) is where this pack stops being utilitarian. Where the B&W and Color nodes hand you a plain module grid, this one can draw every module as a circle, a rounded square, a gapped square, or vertical/horizontal bars - and paint the whole thing with a solid fill or a radial, square, horizontal, or vertical gradient. It's the node you use when the QR code is the design, not a thing to be hidden under ControlNet paint.

    How it works

    Under the hood it's the qrcode library's StyledPilImage with two families of options, and that's the whole mental model:

    • style - six module drawers: CircleModuleDrawer, RoundedModuleDrawer, SquareModuleDrawer, GappedSquareModuleDrawer, VerticalBarsDrawer, HorizontalBarsDrawer. This changes what each individual dark module looks like.
    • color - five color masks: SolidFillColorMask plus radial/square/horizontal/vertical gradients. This is where color_1st, color_2nd, color_3rd come in - the mapping depends on the gradient:
      • SolidFill β†’ 1st = background, 2nd = modules.
      • Radial/Square β†’ 1st = back, 2nd = center, 3rd = edge.
      • Horizontal/Vertical β†’ 1st = back, 2nd = left/top, 3rd = right/bottom.

    Everything else is the same qrcode plumbing as Simple Color: bg_color/fg_color as tuple strings, error_correct, version, box_size, border, and a radius that rounds the whole code - except here the corners outside the radius are filled with hardcoded white, not a pickable color.

    Two version gotchas worth knowing: this is the only node in the pack that needs a recent qrcode (StyledPilImage arrived in qrcode 7.x; the pack pins 8.0), and the code uses Python 3.10+ match statements, so it dies on older Pythons with a syntax error rather than a friendly message.

    The scannability tax

    Here's my honest take: circle and gapped-square modules look great and scan noticeably worse. Gradients look slick and murder the contrast the QR reader depends on. Every style choice here is a trade against the code's ability to actually decode, which is why the README's whole anatomy lesson - finder patterns, quiet zone, error correction levels - suddenly matters. Concretely: keep error_correct on H (the dropdown defaults to L), keep the gradient stops high-contrast (dark 2nd, light 1st), and don't go below a couple of modules of border - the quiet zone is non-negotiable.

    Inputs, briefly

    text, width, height, bg_color, fg_color, error_correct, version (default 1 - raise it for URLs or it errors), box_size, border, radius, style, color, color_1st/2nd/3rd, and mask_color (red/green/blue - which channel the MASK/INVERTED_MASK outputs derive from). Outputs are those three: image plus the two masks.

    Troubleshooting

    • ImportError about styledpil β†’ your environment's qrcode is too old. pip install qrcode==8.0 (which the pack's requirements file already pins).
    • SyntaxError on load β†’ you're on Python < 3.10.
    • Won't scan β†’ too cute. Rounded or square modules, solid fill, error correction H, and verify with the pack's QRCodeReader.

    Installing it

    Same pack, ComfyUI-Simple_QR_Codes: ComfyUI Manager β†’ search "Simple QR Codes" β†’ install β†’ restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/zentrocdot/ComfyUI-Simple_QR_Codes
    cd ComfyUI-Simple_QR_Codes
    pip install -r requirements.txt
    

    No model files. It shows up under QR Code Nodes β†’ qrcode-based after restart.

    Category🍭 QR Code Nodes/🚜 qrcode-based

    Inputs (16)

    NameTypeDefaultDescription
    textSTRINGβ€”
    widthINT5121–8192β€”
    heightINT5121–8192β€”
    bg_colorSTRING(0, 0, 0)β€”
    fg_colorSTRING(255, 255, 255)β€”
    error_correctCOMBO4 options: ERROR_CORRECT_L, ERROR_CORRECT_M, ERROR_CORRECT_Q, ERROR_CORRECT_H
    versionCOMBO40 options: 1, 2, 3, 4, 5, 6, +34
    box_sizeINT100–8192β€”
    borderINT40–8192β€”
    radiusINT00–8192β€”
    styleCOMBO6 options: CircleModuleDrawer, RoundedModuleDrawer, SquareModuleDrawer, GappedSquareModuleDrawer, VerticalBarsDrawer, HorizontalBarsDrawer
    colorCOMBO5 options: RadialGradiantColorMask, SolidFillColorMask, SquareGradiantColorMask, HorizontalGradiantColorMask, VerticalGradiantColorMask
    color_1stSTRING(255, 255, 255)β€”
    color_2ndSTRING(255, 0, 0)β€”
    color_3rdSTRING(255, 0, 255)β€”
    mask_colorCOMBO3 options: red, green, blue

    Outputs (3)

    NameTypeDescription
    IMAGEIMAGEβ€”
    MASKMASKβ€”
    INVERTED_MASKMASKβ€”