Nodes/ComfyQR/QR Code (Conformed to Image Size)
ComfyUI Node

QR Code (Conformed to Image Size)

Exact-size QR codes, for when your canvas doesn't care about modules

By coreyryanhanson·Created 3 years ago·Updated 2 years ago· 90
QR Code (Conformed to Image Size)
    • QR_CODE
    • QR_VERSION
    protocolHttps
    text
    image_size512
    fill_hexcolor#000000
    back_hexcolor#FFFFFF
    error_correctionHigh
    border1
    resamplingNearest
    module_drawerSquare

    Sometimes you don't want a QR that sizes itself by its modules - you want a QR that is exactly 512×512, or 1024×1024, because the rest of your pipeline is fixed at that size. That's what "QR Code (Conformed to Image Size)" is for: it renders the code at native resolution, then resamples it to a target image_size you pick.

    It's a sibling of the plain "QR Code" node in the ComfyQR pack, sharing the same inputs for text, colors, error correction, border, and module drawers. The differences are one new input and one tradeoff:

    • image_size - the exact square output in pixels (64–4096, stepped by 64, default 512).
    • resampling - how it stretches to fit. Default is Nearest, which keeps modules hard-edged; Bicubic, Bilinear, Box, Hamming, and Lanczos are the smooth options.

    My take on resampling: if you're feeding a ControlNet, keep Nearest. Smoothing the modules is a small, silent way to tank scannability before you've generated anything - the model will faithfully copy that softness into the art. The smooth filters exist for a reason, but that reason is mostly decorative output, not conditioning input. If you go soft, know that you're trading scan reliability for aesthetics on purpose.

    Under the hood it's the same python qrcode library as the module-size node, drawn at a fixed box size and then run through PIL's resize() with your chosen filter. The subtlety: conforming by resampling means module boundaries don't land evenly on the pixel grid, which is exactly why Nearest is the sane default for anything destined for a scanner or a ControlNet preprocessor.

    Outputs are just QR_CODE and QR_VERSION - it doesn't expose IMAGE_SIZE because you already told it the size. Error correction still defaults to High, which you should keep for anything that has to scan after a diffusion pass wrecks a few modules.

    Reach for this one when your latent is fixed (512 or 1024), when you're compositing the QR into a specific canvas, or when a preprocessor downstream wants a particular input dimension. Reach for the module-size node when you want maximum crispness and don't need an exact canvas.

    Install is the pack-wide one: ComfyUI Manager → search "ComfyQR", or

    cd ComfyUI/custom_nodes
    git clone https://github.com/coreyryanhanson/ComfyQR
    

    then restart. Just qrcode and pillow, no models, no keys.

    The gotcha specific to this node is soft modules: if your final QR won't scan and you used anything but Nearest, that's the first suspect. Switch back to Nearest, regenerate, and nine times out of ten the reader comes back to life.

    CategoryComfyQR

    Inputs (9)

    NameTypeDefaultDescription
    protocolCOMBOHttps3 options: Http, Https, None
    textSTRING
    image_sizeINT51264–4096
    fill_hexcolorSTRING#000000
    back_hexcolorSTRING#FFFFFF
    error_correctionCOMBOHigh4 options: Low, Medium, Quartile, High
    borderINT10–100
    resamplingCOMBONearest6 options: Bicubic, Bilinear, Box, Hamming, Lanczos, Nearest
    module_drawerCOMBOSquare6 options: Square, Gapped square, Circle, Rounded, Vertical bars, Horizontal bars

    Outputs (2)

    NameTypeDescription
    QR_CODEIMAGE
    QR_VERSIONINT