π Decode QR Code
Decode a QR code from an image β including one that was hiding as a watermark
- image
- decoded_text
- info
This node decodes a QR code that's already sitting in an image - the obvious case being the QR you extracted after hiding it inside a photo with this pack's embed node. It's the last link in the "QR watermark" chain: WatermarkQRCodeGenerator β WatermarkEmbedImage β WatermarkExtractImage β this, and you get your URL or string back out of the pixels.
Before you use it, one honest warning: this node depends on pyzbar, and pyzbar is the most unreliable dependency in the entire pack. It needs a native zbar library that pip doesn't ship, and it's a known pain on Windows. The node handles the failure gracefully - if pyzbar isn't importable you get an empty string and a "pyzbar not installed" message instead of a crash - but you still have to get it installed to use the node at all.
The inputs that matter
- image - the QR you want decoded, as an IMAGE. It doesn't have to be a clean generated QR; a QR recovered from a watermark extraction works too, which is the whole point.
- threshold - binarization threshold, 0 to 255. Default 128 hard-thresholds grayscale. Set it to 0 for auto (Otsu's method picks the split), which is the first thing to try with a noisy or low-contrast QR. The node binarizes first because decoders are dramatically more reliable on a clean black/white image than on gradients.
Outputs are decoded_text (the payload as a string) and info (a status string). If nothing decodes, decoded_text comes back empty and info carries the "No QR Code Found" message with tips.
How it works
Under the hood it's a thin wrapper: convert the tensor to an OpenCV image, grayscale it, binarize with your threshold (or Otsu at 0), then hand the binary image to pyzbar's decode(). One detail worth knowing - if the first pass finds nothing, it retries on the inverted image. That matters because a QR embedded as a watermark, then extracted, can come back inverted or low-contrast enough that only the inverted pass finds it.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/TianDongL/Blind_watermark_Comfyui.git
pip install -r requirements.txt
# restart ComfyUI
Or install "Blind Watermark" via ComfyUI Manager. If pyzbar fails to install - it will, on some Windows setups, because it wants the zbar DLL - you've got options. On Windows you typically need to grab the zbar library separately or install the pyzbar wheel for your Python version. The graceful-degradation message means the rest of the pack keeps working fine without it. And if you just don't want to fight it: the pack's own example workflow decodes QR codes with LayerUtility: DecodeQRCode from ComfyUI-LayerStyle instead. That's a legitimate escape hatch the author shipped with.
Troubleshooting
- Empty result / "No QR Code Found" - set threshold to 0 (auto), make sure the QR is centered and in focus, and remember the image is what came out of a watermark extraction: a little soft is fine, badly re-encoded is not.
- "pyzbar not installed" - either install pyzbar properly or use a different decoder node. This is the node's least favorite failure mode and yours too.
- Decodes in another tool but not here - try the invert behavior by toggling the source (or pre-invert the image); the node retries inverted automatically, but a damaged QR can still lose to both passes.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β | |
| threshold | INT | 1280β255 | Binarization threshold (0=auto) |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| decoded_text | STRING | β |
| info | STRING | β |