v0.0.1
comfy-qr
A set of ComfyUI nodes to dynamically create QR image layers for generative QR art without the hassle of leaving the webui.
This repository is managed publicly on Gitlab, but also mirrored on Github. Please submit any issues or pull requests to the gitlab repo.
Getting started
This project currently contains two nodes for generating QR codes.
QR Code
A dynamically sized QR code without any resampling scaled by the text length, the module size, and the error correction level.
Inputs
protocol- If enabled this will prefix the textbox input with a preset to represent the internet protocol. This is included both for convenience and as a workaround for the textbox clipping strings with this character combination.Http- Adds "http://" before the text.Https- Adds "https://" before the text.None- Uses only the contents of thetextbox.
text- What text to build your QR code with. Ifprotocolis specified, this textbox will be combined it with the selected option.module_size- The pixel width of the smallest unit of a QR code.max_image_size- The maximum size of the resulting QR code. If the combination oftext,module_size, anderror_correctioncreate dimensions that exceed this, an error will halt the pipeline.fill_hexcolor- A string of characters representing the hex value of the QR units. Can be 3 or 6 hexadecimal characters with an optional # before.back_hexcolor- A string of characters representing the hex value of the space around the QR units. Can be 3 or 6 hexadecimal characters with an optional # before.error_correction- The level of error correction to apply.Low- 7% error correction.Medium- 15% error correction.Quartile- 25% error correction.High- 30% error correction.
border- The border size (In multiples ofmodulewidths)
Outputs
IMAGE- The QR codeQR_VERSION- An integer of the QR version that was selected based on the text length and error correction level.IMAGE_SIZE- An integer based on the pixel width of the resulting QR code.
QR Code (Conformed to Image Size)
A QR code fixed to specific output dimensions through image resampling.
Inputs
protocol- If enabled this will prefix the textbox input with a preset to represent the internet protocol. This is included both for convenience and as a workaround for the textbox clipping strings with this character combination.Http- Adds "http://" before the text.Https- Adds "https://" before the text.None- Uses only the contents of thetextbox.
text- What text to build your QR code with. Ifprotocolis specified, this textbox will be combined it with the selected option.image_size- The pixel dimensions to conform the QR code to.fill_hexcolor- A string of characters representing the hex value of the QR units. Can be 3 or 6 hexadecimal characters with an optional # before.back_hexcolor- A string of characters representing the hex value of the space around the QR units. Can be 3 or 6 hexadecimal characters with an optional # before.error_correction- The level of error correction to apply.Low- 7% error correction.Medium- 15% error correction.Quartile- 25% error correction.High- 30% error correction.
border- The border size (In multiples ofmodulewidths)resampling- The resampling algorithm to use when rescaling the QR code.Bicubic- Bicubic interpolationBilinear- Bilinear interpolationBox- Box interpolationHamming- Hamming interpolationLanczos- Lanczos interpolationNearest- Nearest Neighbor interpolation
Outputs
IMAGE- The QR codeQR_VERSION- An integer of the QR version that was selected based on the text length and error correction level.
Future updates
If the solution is clean enough, I plan on implementing a node that will automatically generate a mask to extract the 3 QR markers (based on module_size, border, and QR_VERSION) for more advanced workflows.
Languages
Python
100%