QR Code 圖像產生器
把一般 QR code 變成圖像作品。不再是單純黑白方塊,而是把 QR 圖案直接融合進畫面——讓圖樣成為構圖的一部分,藏在場景的材質、陰影與形狀裡,而不是蓋在畫面上。結果仍能用任何手機相機穩定掃描,但看起來更適合放在海報、專輯封面、名片或產品標籤上。 你只要提供連結,以及描述想要風格的提示詞或參考圖,就能得到一張同時是圖片、也能正常掃描的作品。
關於
此工作流程會把普通 QR code 轉成風格化影像:QR 圖案被融合到材質、陰影與形狀中,而不是疊在畫面上。你提供一個連結(或任何 QR payload),並用文字提示詞或參考影像描述想要的風格。系統會產生一張用手機相機仍能穩定掃描、同時也足夠適合用於海報、專輯封面、名片或產品標籤的圖像。
技術上,主要處理都在單一自訂節點中完成(UUID: 323b0c6a-e2f0-42c3-93b4-36b7878136fd)。此節點會把你的 URL 編碼成 QR 矩陣,接著生成或風格化影像,讓局部對比與邊緣能對齊 QR 模組,並在構圖內保留可讀的圖樣。你可以透過調整 style strength 與 QR visibility 在美感與可讀性之間取捨。最終影像由 SaveImage 節點以 PNG 格式寫入 ComfyUI 的 output 資料夾。
您提供的內容
- 正在讀取工作流程
在 ComfyUI 中執行。 此工作流程無法在此頁面上執行。請在已載入所有內容的 Comfy Cloud 中開啟,或下載到您自己的 ComfyUI。
在 Cloud 中試用工作流程內部
節點圖的唯讀預覽。請在 Comfy Cloud 中開啟,或下載後編輯節點。
Loading the graph
Open full-size workflow preview需要自訂節點
- 正在讀取工作流程
從程式碼使用此工作流程
可行時會根據工作流程圖和輸入內容產生;否則會顯示儲存的範例。執行可能產生費用的程式碼前,請檢查認證資訊和端點。
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
需要付費 Cloud 方案與點數。
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"71": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"90:74",
0
]
},
"_meta": {
"title": "Preview Render"
}
},
"87": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"90:84",
0
]
},
"_meta": {
"title": "Final Render"
}
},
"90:10": {
"class_type": "KSamplerAdvanced",
"inputs": {
"add_noise": "enable",
"cfg": 8,
"end_at_step": 1000,
"latent_image": [
"90:5",
0
],
"model": [
"90:4",
0
],
"negative": [
"90:55",
1
],
"noise_seed": 734583316628915,
"positive": [
"90:55",
0
],
"return_with_leftover_noise": "disable",
"sampler_name": "euler",
"scheduler": "normal",
"start_at_step": 0,
"steps": 25
},
"_meta": {
"title": "KSampler (Advanced) - BASE"
}
},
"90:17": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"90:10",
0
],
"vae": [
"90:4",
2
]
},
"_meta": {
"title": "VAE Decode"
}
},
"90:4": {
"class_type": "CheckpointLoaderSimple",
"inputs": {
"ckpt_name": "Juggernaut-XL_v9_RunDiffusionPhoto_v2.safetensors"
},
"_meta": {
"title": "Load Checkpoint - BASE"
}
},
"90:5": {
"class_type": "EmptyLatentImage",
"inputs": {
"batch_size": 1,
"height": [
"90:76",
0
],
"width": [
"90:76",
0
]
},
"_meta": {
"title": "Empty Latent Image"
}
},
"90:54": {
"class_type": "comfy-qr-by-module-size",
"inputs": {
"back_hexcolor": "#FFFFFF",
"border": 4,
"error_correction": "High",
"fill_hexcolor": "#000000",
"max_image_size": 768,
"module_drawer": "Rounded",
"module_size": 16,
"protocol": "None",
"text": "comfy.org"
},
"_meta": {
"title": "QR Code"
}
},
"90:55": {
"class_type": "ControlNetApplyAdvanced",
"inputs": {
"control_net": [
"90:56",
0
],
"end_percent": 1,
"image": [
"90:73",
0
],
"negative": [
"90:7",
0
],
"positive": [
"90:6",
0
],
"start_percent": 0,
"strength": 1,
"vae": [
"90:4",
2
]
},
"_meta": {
"title": "Apply ControlNet"
}
},
"90:56": {
"class_type": "ControlNetLoader",
"inputs": {
"control_net_name": "qrCodeMonsterSDXL_v10.safetensors"
},
"_meta": {
"title": "Load ControlNet Model"
}
},
"90:58": {
"class_type": "Convert Color Space",
"inputs": {
"image": [
"90:17",
0
],
"in_space": "RGB",
"out_space": "HSV"
},
"_meta": {
"title": "Convert Color Space"
}
},
"90:59": {
"class_type": "Combine Masks",
"inputs": {
"clamp_result": "yes",
"image1": [
"90:58",
0
],
"image2": [
"90:69",
0
],
"op": "add",
"round_result": "no"
},
"_meta": {
"title": "Combine Masks"
}
},
"90:6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"90:4",
1
],
"text": "sushi"
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"90:60": {
"class_type": "Combine Masks",
"inputs": {
"clamp_result": "no",
"image1": [
"90:63",
0
],
"image2": [
"90:61",
0
],
"op": "add",
"round_result": "no"
},
"_meta": {
"title": "Combine Masks"
}
},
"90:61": {
"class_type": "Constant Mask",
"inputs": {
"copy_image_size": [
"90:63",
0
],
"explicit_height": 0,
"explicit_width": 0,
"value": -1
},
"_meta": {
"title": "Constant Mask"
}
},
"90:63": {
"class_type": "Combine Masks",
"inputs": {
"clamp_result": "no",
"image1": [
"90:73",
0
],
"image2": [
"90:64",
0
],
"op": "multiply",
"round_result": "no"
},
"_meta": {
"title": "Combine Masks"
}
},
"90:64": {
"class_type": "Constant Mask",
"inputs": {
"copy_image_size": [
"90:73",
0
],
"explicit_height": 0,
"explicit_width": 0,
"value": 2
},
"_meta": {
"title": "Constant Mask"
}
},
"90:65": {
"class_type": "Combine Masks",
"inputs": {
"clamp_result": "no",
"image1": [
"90:60",
0
],
"image2": [
"90:66",
0
],
"op": "multiply",
"round_result": "no"
},
"_meta": {
"title": "Combine Masks"
}
},
"90:66": {
"class_type": "Constant Mask",
"inputs": {
"copy_image_size": [
"90:60",
0
],
"explicit_height": 0,
"explicit_width": 0,
"value": 0.2
},
"_meta": {
"title": "Constant Mask"
}
},
"90:69": {
"class_type": "Combine Masks",
"inputs": {
"clamp_result": "no",
"image1": [
"90:65",
0
],
"image2": [
"90:77",
0
],
"op": "multiply",
"round_result": "no"
},
"_meta": {
"title": "Combine Masks"
}
},
"90:7": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"90:4",
1
],
"text": "text, watermark, nudity, nsfw"
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"90:73": {
"class_type": "ResizeImageMaskNode",
"inputs": {
"input": [
"90:79",
0
],
"resize_type": "scale dimensions",
"resize_type.crop": "center",
"resize_type.height": [
"90:76",
0
],
"resize_type.width": [
"90:76",
0
],
"scale_method": "area"
},
"_meta": {
"title": "Resize Image/Mask"
}
},
"90:74": {
"class_type": "Convert Color Space",
"inputs": {
"image": [
"90:59",
0
],
"in_space": "HSV",
"out_space": "RGB"
},
"_meta": {
"title": "Convert Color Space"
}
},
"90:76": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 1024
},
"_meta": {
"title": "Int"
}
},
"90:77": {
"class_type": "Mix Color By Mask",
"inputs": {
"b": 255,
"g": 0,
"image": [
"90:78",
0
],
"mask": [
"90:78",
0
],
"r": 0
},
"_meta": {
"title": "Mix Color By Mask"
}
},
"90:78": {
"class_type": "Constant Mask",
"inputs": {
"copy_image_size": [
"90:63",
0
],
"explicit_height": 0,
"explicit_width": 0,
"value": 1
},
"_meta": {
"title": "Constant Mask"
}
},
"90:79": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"90:54",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"90:82": {
"class_type": "UltimateSDUpscale",
"inputs": {
"cfg": 8,
"denoise": 0.21,
"force_uniform_tiles": True,
"image": [
"90:74",
0
],
"mask_blur": 8,
"mode_type": "Linear",
"model": [
"90:4",
0
],
"negative": [
"90:85",
1
],
"positive": [
"90:85",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seam_fix_denoise": 1,
"seam_fix_mask_blur": 8,
"seam_fix_mode": "None",
"seam_fix_padding": 16,
"seam_fix_width": 64,
"seed": 120,
"steps": 25,
"tile_height": 1024,
"tile_padding": 32,
"tile_width": 1024,
"tiled_decode": False,
"upscale_by": 2,
"upscale_model": [
"90:88",
0
],
"vae": [
"90:4",
2
]
},
"_meta": {
"title": "Ultimate SD Upscale"
}
},
"90:84": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"90:74",
0
],
"on_true": [
"90:82",
0
],
"switch": True
},
"_meta": {
"title": "If/Else Switch"
}
},
"90:85": {
"class_type": "ControlNetApplyAdvanced",
"inputs": {
"control_net": [
"90:86",
0
],
"end_percent": 1,
"image": [
"90:74",
0
],
"negative": [
"90:7",
0
],
"positive": [
"90:6",
0
],
"start_percent": 0,
"strength": 1,
"vae": [
"90:4",
2
]
},
"_meta": {
"title": "Apply ControlNet"
}
},
"90:86": {
"class_type": "ControlNetLoader",
"inputs": {
"control_net_name": "ttplanetSDXLControlnet_v20Fp16.safetensors"
},
"_meta": {
"title": "Load ControlNet Model"
}
},
"90:88": {
"class_type": "UpscaleModelLoader",
"inputs": {
"model_name": "RealESRGAN_x4plus.pth"
},
"_meta": {
"title": "Load Upscale Model"
}
},
"90:89": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"90:17",
0
]
},
"_meta": {
"title": "Preview Image"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)問答
提高 QR visibility,降低 QR 區域附近的整體 style strength,保留 QR 四周的 quiet zone(空白邊界),並避免對模組做極端模糊或重度材質覆蓋。同時在一般室內光源下測試,並確保最後裁切沒有切到 QR 邊緣。
可以。把參考影像提供給自訂 QR 節點。節點會在借用參考圖色彩與結構的同時,讓材質與邊緣對齊 QR 矩陣。若變得難以掃描,請降低 style strength 或選擇更簡單的參考圖。
建議從正方形畫布開始,以保持 QR 比例一致。更高解析度有助於細節,但要確保 QR 模組仍然清晰且具足夠對比。印刷用途建議以最終印刷尺寸生成,或放大後務必重新測試掃描。
SaveImage 會把輸出以 PNG 檔寫入你的 ComfyUI/output 資料夾。每次執行都會產生新檔案;可用 seed 或命名選項整理版本。