From b3daaafcf0e900edf855d232aa8107efe48ac048 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Tue, 8 Aug 2023 10:28:46 -0700 Subject: [PATCH 1/4] Fixed qrcode to return numeric values instead of True/False added the ability to Scale/Pad/None to resize. Allow White, Grey or Black for pad colors. --- MaskNodes.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/MaskNodes.py b/MaskNodes.py index fc5ee8d..952a6de 100644 --- a/MaskNodes.py +++ b/MaskNodes.py @@ -1111,11 +1111,13 @@ def INPUT_TYPES(cls): return { "required": { "text": ("STRING", {"multiline": True}), + "resize": (["Scale", "Pad", "None"], {"default": "Scale"}), "size": ("INT", {"default": 512, "min": 64, "max": 4096, "step": 64}), "qr_version": ("INT", {"default": 1, "min": 1, "max": 40, "step": 1}), "error_correction": (["L", "M", "Q", "H"], {"default": "H"}), "box_size": ("INT", {"default": 10, "min": 1, "max": 100, "step": 1}), "border": ("INT", {"default": 4, "min": 0, "max": 100, "step": 1}), + "pad_color": (["White", "Grey", "Black"], {"default": "White"}), }, } @@ -1124,7 +1126,7 @@ def INPUT_TYPES(cls): CATEGORY = "Masquerade Nodes" - def create_qr_code(self, text, size, qr_version, error_correction, box_size, border): + def create_qr_code(self, text, resize, size, qr_version, error_correction, box_size, border, pad_color): ensure_package("qrcode") import qrcode if error_correction =="L": @@ -1144,9 +1146,18 @@ def create_qr_code(self, text, size, qr_version, error_correction, box_size, bor qr.add_data(text) qr.make(fit=True) img = qr.make_image(fill_color="black", back_color="white") - img = img.resize((size,size)) + if resize == "Scale": + img = img.resize((size, size)) # Convert img (a PIL Image) into a torch tensor - tensor = torch.from_numpy(np.array(img)) + tensor = torch.from_numpy(np.array(img)).float() + + if resize == "Pad": + # if the size is larger then pad + if tensor.shape[1] < size: + padding = (size - tensor.shape[1]) // 2 + color = {"White": 1.0, "Grey": 0.5, "Black": 0.0}.get(pad_color, 0) + tensor = torchfn.pad(tensor, [padding, padding, padding, padding], value=color) + return (tensor2rgb(tensor.unsqueeze(0)),) def rgb2hsv(rgb): From 9064d1dd90bffad7483d55c0c726ce4e6b6cafbb Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Tue, 8 Aug 2023 10:47:27 -0700 Subject: [PATCH 2/4] qrcode example json --- examples/qrcode-monster-controlnet.json | 1541 +++++++++++++++++++++++ 1 file changed, 1541 insertions(+) create mode 100644 examples/qrcode-monster-controlnet.json diff --git a/examples/qrcode-monster-controlnet.json b/examples/qrcode-monster-controlnet.json new file mode 100644 index 0000000..a7adcc8 --- /dev/null +++ b/examples/qrcode-monster-controlnet.json @@ -0,0 +1,1541 @@ +{ + "last_node_id": 49, + "last_link_id": 113, + "nodes": [ + { + "id": 6, + "type": "Reroute", + "pos": [ + 603.2845951379386, + 27.707613676490737 + ], + "size": [ + 75, + 26 + ], + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 8 + } + ], + "outputs": [ + { + "name": "", + "type": "MODEL", + "links": [ + 9 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": false, + "horizontal": false + } + }, + { + "id": 7, + "type": "Reroute", + "pos": [ + 1237, + 30 + ], + "size": [ + 75, + 26 + ], + "flags": {}, + "order": 12, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 9 + } + ], + "outputs": [ + { + "name": "", + "type": "MODEL", + "links": [ + 10 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": false, + "horizontal": false + } + }, + { + "id": 4, + "type": "Reroute", + "pos": [ + 508, + 90 + ], + "size": [ + 75, + 26 + ], + "flags": {}, + "order": 7, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 3 + } + ], + "outputs": [ + { + "name": "", + "type": "CLIP", + "links": [ + 4, + 5 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": false, + "horizontal": false + } + }, + { + "id": 2, + "type": "CLIPTextEncode", + "pos": [ + 633, + 93 + ], + "size": { + "0": 399.8425598144531, + "1": 123.48873138427734 + }, + "flags": {}, + "order": 13, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 4 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 14 + ], + "shape": 3, + "slot_index": 0 + } + ], + "title": "CLIP Text Encode (Positive Prompt)", + "properties": { + "Node name for S&R": "CLIPTextEncode" + }, + "widgets_values": [ + "Snowy Mountain cabin with pine trees, 16k, uhd, award winning, highly detailed" + ], + "color": "#223", + "bgcolor": "#335" + }, + { + "id": 11, + "type": "ControlNetLoader", + "pos": [ + 66, + 259 + ], + "size": { + "0": 472.8611755371094, + "1": 76.4640121459961 + }, + "flags": {}, + "order": 0, + "mode": 0, + "outputs": [ + { + "name": "CONTROL_NET", + "type": "CONTROL_NET", + "links": [ + 30 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ControlNetLoader" + }, + "widgets_values": [ + "control_v1p_sd15_qrcode_monster_v2.safetensors" + ] + }, + { + "id": 17, + "type": "Reroute", + "pos": [ + 558, + 472 + ], + "size": [ + 75, + 26 + ], + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 30 + } + ], + "outputs": [ + { + "name": "", + "type": "CONTROL_NET", + "links": [ + 25 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": false, + "horizontal": false + } + }, + { + "id": 18, + "type": "Reroute", + "pos": [ + 951, + 477 + ], + "size": [ + 75, + 26 + ], + "flags": {}, + "order": 11, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 25 + } + ], + "outputs": [ + { + "name": "", + "type": "CONTROL_NET", + "links": [ + 26 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": false, + "horizontal": false + } + }, + { + "id": 20, + "type": "Reroute", + "pos": [ + 961, + 531 + ], + "size": [ + 75, + 26 + ], + "flags": {}, + "order": 21, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 28 + } + ], + "outputs": [ + { + "name": "", + "type": "IMAGE", + "links": [ + 29 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": false, + "horizontal": false + } + }, + { + "id": 22, + "type": "Reroute", + "pos": [ + 1865, + 638 + ], + "size": [ + 75, + 26 + ], + "flags": {}, + "order": 15, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 33 + } + ], + "outputs": [ + { + "name": "", + "type": "VAE", + "links": [ + 34 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": false, + "horizontal": false + } + }, + { + "id": 21, + "type": "Reroute", + "pos": [ + 674, + 637 + ], + "size": [ + 75, + 26 + ], + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 32 + } + ], + "outputs": [ + { + "name": "", + "type": "VAE", + "links": [ + 33 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": false, + "horizontal": false + } + }, + { + "id": 25, + "type": "UpscaleModelLoader", + "pos": [ + 1868, + 428 + ], + "size": { + "0": 315, + "1": 58 + }, + "flags": {}, + "order": 1, + "mode": 0, + "outputs": [ + { + "name": "UPSCALE_MODEL", + "type": "UPSCALE_MODEL", + "links": [ + 38 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "UpscaleModelLoader" + }, + "widgets_values": [ + "ESRGAN_4x.pth" + ] + }, + { + "id": 3, + "type": "CLIPTextEncode", + "pos": [ + 633, + 272 + ], + "size": { + "0": 394.1120910644531, + "1": 189.6284942626953 + }, + "flags": {}, + "order": 14, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 5 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 43 + ], + "shape": 3, + "slot_index": 0 + } + ], + "title": "CLIP Text Encode (Negative Prompt)", + "properties": { + "Node name for S&R": "CLIPTextEncode" + }, + "widgets_values": [ + "blurry, (poorly drawn face:1.3), (bad anatomy:1.4), (bad proportions:1.5), dehydrated, (ugly:1.2), morbid, (mutated hands:1.4), extra fingers, extra arms, extra legs, (fused fingers:1.2), (long neck:1.3), (low quality:1.5), (low-res:1.4), (worst quality:1.6), (deformed:1.5), (disfigured:1.4), malformed limbs, missing arms, missing legs, (mutated:1.4), mutilated, (gross proportions:1.2), (blurry:1.3), (cropped:1.2), (out of frame:1.2), (duplicate:1.3), (cloned face:1.3), (extra limbs:1.3), (JPEG artifacts:1.2), (error:1.1), (username:1.6), (signature:1.6), (watermark:1.6), (text:1.6)\n" + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 19, + "type": "Reroute", + "pos": [ + 560, + 523 + ], + "size": [ + 75, + 26 + ], + "flags": {}, + "order": 20, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 105 + } + ], + "outputs": [ + { + "name": "", + "type": "IMAGE", + "links": [ + 28 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": false, + "horizontal": false + } + }, + { + "id": 35, + "type": "PreviewImage", + "pos": [ + 1570, + 720 + ], + "size": { + "0": 210, + "1": 246 + }, + "flags": {}, + "order": 19, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 104 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 5, + "type": "KSampler", + "pos": [ + 1685, + 62 + ], + "size": { + "0": 315, + "1": 262 + }, + "flags": {}, + "order": 23, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 10 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 17 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 44 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 36 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 20 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "KSampler" + }, + "widgets_values": [ + 723107318612049, + "randomize", + 50, + 4, + "dpmpp_2m_sde", + "normal", + 1 + ] + }, + { + "id": 8, + "type": "EmptyLatentImage", + "pos": [ + 1155, + 528 + ], + "size": { + "0": 315, + "1": 106 + }, + "flags": {}, + "order": 9, + "mode": 0, + "inputs": [ + { + "name": "width", + "type": "INT", + "link": 107, + "widget": { + "name": "width", + "config": [ + "INT", + { + "default": 512, + "min": 64, + "max": 8192, + "step": 8 + } + ] + } + }, + { + "name": "height", + "type": "INT", + "link": 108, + "widget": { + "name": "height", + "config": [ + "INT", + { + "default": 512, + "min": 64, + "max": 8192, + "step": 8 + } + ] + } + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 36 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "EmptyLatentImage" + }, + "widgets_values": [ + 768, + 768, + 1 + ] + }, + { + "id": 1, + "type": "CheckpointLoaderSimple", + "pos": [ + 72, + 68 + ], + "size": { + "0": 410.642822265625, + "1": 117.83045196533203 + }, + "flags": {}, + "order": 2, + "mode": 0, + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 8 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "CLIP", + "type": "CLIP", + "links": [ + 3 + ], + "shape": 3, + "slot_index": 1 + }, + { + "name": "VAE", + "type": "VAE", + "links": [ + 32 + ], + "shape": 3, + "slot_index": 2 + } + ], + "properties": { + "Node name for S&R": "CheckpointLoaderSimple" + }, + "widgets_values": [ + "Fantasy/revAnimated_v122.safetensors" + ] + }, + { + "id": 10, + "type": "ControlNetApplyAdvanced", + "pos": [ + 1142, + 282 + ], + "size": { + "0": 315, + "1": 166 + }, + "flags": {}, + "order": 22, + "mode": 0, + "inputs": [ + { + "name": "positive", + "type": "CONDITIONING", + "link": 14, + "slot_index": 0 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 43, + "slot_index": 1 + }, + { + "name": "control_net", + "type": "CONTROL_NET", + "link": 26, + "slot_index": 2 + }, + { + "name": "image", + "type": "IMAGE", + "link": 29 + } + ], + "outputs": [ + { + "name": "positive", + "type": "CONDITIONING", + "links": [ + 17 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "negative", + "type": "CONDITIONING", + "links": [ + 44 + ], + "shape": 3, + "slot_index": 1 + } + ], + "properties": { + "Node name for S&R": "ControlNetApplyAdvanced" + }, + "widgets_values": [ + 1.5, + 0.30000000000000004, + 0.8999090576171881 + ] + }, + { + "id": 24, + "type": "ImageUpscaleWithModel", + "pos": [ + 2289, + 429 + ], + "size": { + "0": 241.79998779296875, + "1": 46 + }, + "flags": {}, + "order": 25, + "mode": 0, + "inputs": [ + { + "name": "upscale_model", + "type": "UPSCALE_MODEL", + "link": 38 + }, + { + "name": "image", + "type": "IMAGE", + "link": 111 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 112 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ImageUpscaleWithModel" + } + }, + { + "id": 13, + "type": "VAEDecode", + "pos": [ + 2089.375393449767, + 88.39890276696067 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 24, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 20 + }, + { + "name": "vae", + "type": "VAE", + "link": 34 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 111, + 113 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "VAEDecode" + } + }, + { + "id": 47, + "type": "SeargeIntegerConstant", + "pos": [ + 610, + 710 + ], + "size": { + "0": 315, + "1": 58 + }, + "flags": {}, + "order": 3, + "mode": 0, + "outputs": [ + { + "name": "value", + "type": "INT", + "links": [ + 107, + 108, + 109 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "SeargeIntegerConstant" + }, + "widgets_values": [ + 768 + ] + }, + { + "id": 42, + "type": "Get Image Size", + "pos": [ + 460, + 810 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 90 + } + ], + "outputs": [ + { + "name": "INT", + "type": "INT", + "links": [ + 92 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "INT", + "type": "INT", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "Get Image Size" + } + }, + { + "id": 44, + "type": "SeargeIntegerMath", + "pos": [ + 500, + 920 + ], + "size": { + "0": 315, + "1": 130 + }, + "flags": {}, + "order": 16, + "mode": 0, + "inputs": [ + { + "name": "c", + "type": "INT", + "link": 92, + "widget": { + "name": "c", + "config": [ + "INT", + { + "default": 0, + "min": 0, + "max": 18446744073709552000 + } + ] + } + }, + { + "name": "a", + "type": "INT", + "link": 109, + "widget": { + "name": "a", + "config": [ + "INT", + { + "default": 0, + "min": 0, + "max": 18446744073709552000 + } + ] + } + } + ], + "outputs": [ + { + "name": "result", + "type": "INT", + "links": [ + 93 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "SeargeIntegerMath" + }, + "widgets_values": [ + "a - c", + 768, + 1, + 0 + ] + }, + { + "id": 45, + "type": "SeargeIntegerMath", + "pos": [ + 680, + 1130 + ], + "size": { + "0": 315, + "1": 130 + }, + "flags": {}, + "order": 17, + "mode": 0, + "inputs": [ + { + "name": "a", + "type": "INT", + "link": 93, + "widget": { + "name": "a", + "config": [ + "INT", + { + "default": 0, + "min": 0, + "max": 18446744073709552000 + } + ] + } + } + ], + "outputs": [ + { + "name": "result", + "type": "INT", + "links": [ + 100, + 101, + 102, + 103 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "SeargeIntegerMath" + }, + "widgets_values": [ + "a / b", + 512, + 2, + 0 + ] + }, + { + "id": 39, + "type": "Create QR Code", + "pos": [ + 2, + 767 + ], + "size": { + "0": 400, + "1": 220.00001525878906 + }, + "flags": {}, + "order": 4, + "mode": 0, + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 90, + 106 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "Create QR Code" + }, + "widgets_values": [ + "Snowy Mountain Cabin", + "False", + 512, + 2, + "H", + 16, + 1 + ] + }, + { + "id": 46, + "type": "Image Pad", + "pos": [ + 930, + 830 + ], + "size": { + "0": 315, + "1": 154 + }, + "flags": {}, + "order": 18, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 106 + }, + { + "name": "top", + "type": "INT", + "link": 100, + "widget": { + "name": "top", + "config": [ + "INT", + { + "default": 32, + "min": 0, + "max": 4096, + "step": 1 + } + ] + } + }, + { + "name": "bottom", + "type": "INT", + "link": 101, + "widget": { + "name": "bottom", + "config": [ + "INT", + { + "default": 32, + "min": 0, + "max": 4096, + "step": 1 + } + ] + } + }, + { + "name": "left", + "type": "INT", + "link": 102, + "widget": { + "name": "left", + "config": [ + "INT", + { + "default": 32, + "min": 0, + "max": 4096, + "step": 1 + } + ] + } + }, + { + "name": "right", + "type": "INT", + "link": 103, + "widget": { + "name": "right", + "config": [ + "INT", + { + "default": 32, + "min": 0, + "max": 4096, + "step": 1 + } + ] + } + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 104, + 105 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "Image Pad" + }, + "widgets_values": [ + 32, + 32, + 32, + 32, + "Grey" + ] + }, + { + "id": 48, + "type": "SaveImage", + "pos": [ + 2024, + 709 + ], + "size": { + "0": 594.291259765625, + "1": 605.5518798828125 + }, + "flags": {}, + "order": 27, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 112 + } + ], + "properties": {}, + "widgets_values": [ + "qrcode_%date:MM_dd_yyyy%/qr_hires_" + ] + }, + { + "id": 49, + "type": "SaveImage", + "pos": [ + 2453.0990710449205, + 58.733161468505756 + ], + "size": [ + 342.8522340249792, + 310.20108721760175 + ], + "flags": {}, + "order": 26, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 113 + } + ], + "properties": {}, + "widgets_values": [ + "qrcode_%date:MM_dd_yyyy%/qr_lores_" + ] + } + ], + "links": [ + [ + 3, + 1, + 1, + 4, + 0, + "*" + ], + [ + 4, + 4, + 0, + 2, + 0, + "CLIP" + ], + [ + 5, + 4, + 0, + 3, + 0, + "CLIP" + ], + [ + 8, + 1, + 0, + 6, + 0, + "*" + ], + [ + 9, + 6, + 0, + 7, + 0, + "*" + ], + [ + 10, + 7, + 0, + 5, + 0, + "MODEL" + ], + [ + 14, + 2, + 0, + 10, + 0, + "CONDITIONING" + ], + [ + 17, + 10, + 0, + 5, + 1, + "CONDITIONING" + ], + [ + 20, + 5, + 0, + 13, + 0, + "LATENT" + ], + [ + 25, + 17, + 0, + 18, + 0, + "*" + ], + [ + 26, + 18, + 0, + 10, + 2, + "CONTROL_NET" + ], + [ + 28, + 19, + 0, + 20, + 0, + "*" + ], + [ + 29, + 20, + 0, + 10, + 3, + "IMAGE" + ], + [ + 30, + 11, + 0, + 17, + 0, + "*" + ], + [ + 32, + 1, + 2, + 21, + 0, + "*" + ], + [ + 33, + 21, + 0, + 22, + 0, + "*" + ], + [ + 34, + 22, + 0, + 13, + 1, + "VAE" + ], + [ + 36, + 8, + 0, + 5, + 3, + "LATENT" + ], + [ + 38, + 25, + 0, + 24, + 0, + "UPSCALE_MODEL" + ], + [ + 43, + 3, + 0, + 10, + 1, + "CONDITIONING" + ], + [ + 44, + 10, + 1, + 5, + 2, + "CONDITIONING" + ], + [ + 90, + 39, + 0, + 42, + 0, + "IMAGE" + ], + [ + 92, + 42, + 0, + 44, + 0, + "INT" + ], + [ + 93, + 44, + 0, + 45, + 0, + "INT" + ], + [ + 100, + 45, + 0, + 46, + 1, + "INT" + ], + [ + 101, + 45, + 0, + 46, + 2, + "INT" + ], + [ + 102, + 45, + 0, + 46, + 3, + "INT" + ], + [ + 103, + 45, + 0, + 46, + 4, + "INT" + ], + [ + 104, + 46, + 0, + 35, + 0, + "IMAGE" + ], + [ + 105, + 46, + 0, + 19, + 0, + "*" + ], + [ + 106, + 39, + 0, + 46, + 0, + "IMAGE" + ], + [ + 107, + 47, + 0, + 8, + 0, + "INT" + ], + [ + 108, + 47, + 0, + 8, + 1, + "INT" + ], + [ + 109, + 47, + 0, + 44, + 1, + "INT" + ], + [ + 111, + 13, + 0, + 24, + 1, + "IMAGE" + ], + [ + 112, + 24, + 0, + 48, + 0, + "IMAGE" + ], + [ + 113, + 13, + 0, + 49, + 0, + "IMAGE" + ] + ], + "groups": [], + "config": {}, + "extra": {}, + "version": 0.4 +} \ No newline at end of file From 631c7a94b3c07665c3d83a1c895e5a08955769ea Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Tue, 8 Aug 2023 10:54:14 -0700 Subject: [PATCH 3/4] Update the README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4d54904..a902a90 100644 --- a/README.md +++ b/README.md @@ -277,11 +277,13 @@ This node is the same as Unary Mask Op, but will operate across all channels of ## Create QR Code #### Inputs * `text` - The content to embed in the QR Code +* `resize` - how to resize 'Scale' will scale the qr code, 'Pad' will pad if the qr code is smaller then the size, 'None' will do nothing. * `size` - The size of the QR Code (across height and width) in pixels. * `qr_version` - The version of QR Code to use. Higher versions can encode more data, but are larger. * `error_correction` - The level of error correction to use. * `box_size` - The size of each box in the QR Code in pixels. * `border` - The size of the border around the QR Code in pixels. +* `pad_color` - The color to pad with, 'White', 'Grey', 'Black' ## Convert Color Space #### Inputs From 4ad9ed081fb481556a449b50d951912248683c9f Mon Sep 17 00:00:00 2001 From: mishafarms Date: Tue, 8 Aug 2023 11:16:03 -0700 Subject: [PATCH 4/4] fixed json. --- examples/qrcode-monster-controlnet.json | 832 ++++++++---------------- 1 file changed, 255 insertions(+), 577 deletions(-) diff --git a/examples/qrcode-monster-controlnet.json b/examples/qrcode-monster-controlnet.json index a7adcc8..8dc3139 100644 --- a/examples/qrcode-monster-controlnet.json +++ b/examples/qrcode-monster-controlnet.json @@ -1,6 +1,6 @@ { - "last_node_id": 49, - "last_link_id": 113, + "last_node_id": 50, + "last_link_id": 120, "nodes": [ { "id": 6, @@ -14,7 +14,7 @@ 26 ], "flags": {}, - "order": 6, + "order": 5, "mode": 0, "inputs": [ { @@ -50,7 +50,7 @@ 26 ], "flags": {}, - "order": 12, + "order": 11, "mode": 0, "inputs": [ { @@ -86,7 +86,7 @@ 26 ], "flags": {}, - "order": 7, + "order": 6, "mode": 0, "inputs": [ { @@ -123,7 +123,7 @@ "1": 123.48873138427734 }, "flags": {}, - "order": 13, + "order": 12, "mode": 0, "inputs": [ { @@ -197,7 +197,7 @@ 26 ], "flags": {}, - "order": 5, + "order": 4, "mode": 0, "inputs": [ { @@ -233,7 +233,7 @@ 26 ], "flags": {}, - "order": 11, + "order": 10, "mode": 0, "inputs": [ { @@ -257,42 +257,6 @@ "horizontal": false } }, - { - "id": 20, - "type": "Reroute", - "pos": [ - 961, - 531 - ], - "size": [ - 75, - 26 - ], - "flags": {}, - "order": 21, - "mode": 0, - "inputs": [ - { - "name": "", - "type": "*", - "link": 28 - } - ], - "outputs": [ - { - "name": "", - "type": "IMAGE", - "links": [ - 29 - ], - "slot_index": 0 - } - ], - "properties": { - "showOutputText": false, - "horizontal": false - } - }, { "id": 22, "type": "Reroute", @@ -305,7 +269,7 @@ 26 ], "flags": {}, - "order": 15, + "order": 14, "mode": 0, "inputs": [ { @@ -341,7 +305,7 @@ 26 ], "flags": {}, - "order": 8, + "order": 7, "mode": 0, "inputs": [ { @@ -409,7 +373,7 @@ "1": 189.6284942626953 }, "flags": {}, - "order": 14, + "order": 13, "mode": 0, "inputs": [ { @@ -439,67 +403,6 @@ "color": "#322", "bgcolor": "#533" }, - { - "id": 19, - "type": "Reroute", - "pos": [ - 560, - 523 - ], - "size": [ - 75, - 26 - ], - "flags": {}, - "order": 20, - "mode": 0, - "inputs": [ - { - "name": "", - "type": "*", - "link": 105 - } - ], - "outputs": [ - { - "name": "", - "type": "IMAGE", - "links": [ - 28 - ], - "slot_index": 0 - } - ], - "properties": { - "showOutputText": false, - "horizontal": false - } - }, - { - "id": 35, - "type": "PreviewImage", - "pos": [ - 1570, - 720 - ], - "size": { - "0": 210, - "1": 246 - }, - "flags": {}, - "order": 19, - "mode": 0, - "inputs": [ - { - "name": "images", - "type": "IMAGE", - "link": 104 - } - ], - "properties": { - "Node name for S&R": "PreviewImage" - } - }, { "id": 5, "type": "KSampler", @@ -512,7 +415,7 @@ "1": 262 }, "flags": {}, - "order": 23, + "order": 19, "mode": 0, "inputs": [ { @@ -551,7 +454,7 @@ "Node name for S&R": "KSampler" }, "widgets_values": [ - 723107318612049, + 86279305602227, "randomize", 50, 4, @@ -560,76 +463,6 @@ 1 ] }, - { - "id": 8, - "type": "EmptyLatentImage", - "pos": [ - 1155, - 528 - ], - "size": { - "0": 315, - "1": 106 - }, - "flags": {}, - "order": 9, - "mode": 0, - "inputs": [ - { - "name": "width", - "type": "INT", - "link": 107, - "widget": { - "name": "width", - "config": [ - "INT", - { - "default": 512, - "min": 64, - "max": 8192, - "step": 8 - } - ] - } - }, - { - "name": "height", - "type": "INT", - "link": 108, - "widget": { - "name": "height", - "config": [ - "INT", - { - "default": 512, - "min": 64, - "max": 8192, - "step": 8 - } - ] - } - } - ], - "outputs": [ - { - "name": "LATENT", - "type": "LATENT", - "links": [ - 36 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "EmptyLatentImage" - }, - "widgets_values": [ - 768, - 768, - 1 - ] - }, { "id": 1, "type": "CheckpointLoaderSimple", @@ -680,74 +513,6 @@ "Fantasy/revAnimated_v122.safetensors" ] }, - { - "id": 10, - "type": "ControlNetApplyAdvanced", - "pos": [ - 1142, - 282 - ], - "size": { - "0": 315, - "1": 166 - }, - "flags": {}, - "order": 22, - "mode": 0, - "inputs": [ - { - "name": "positive", - "type": "CONDITIONING", - "link": 14, - "slot_index": 0 - }, - { - "name": "negative", - "type": "CONDITIONING", - "link": 43, - "slot_index": 1 - }, - { - "name": "control_net", - "type": "CONTROL_NET", - "link": 26, - "slot_index": 2 - }, - { - "name": "image", - "type": "IMAGE", - "link": 29 - } - ], - "outputs": [ - { - "name": "positive", - "type": "CONDITIONING", - "links": [ - 17 - ], - "shape": 3, - "slot_index": 0 - }, - { - "name": "negative", - "type": "CONDITIONING", - "links": [ - 44 - ], - "shape": 3, - "slot_index": 1 - } - ], - "properties": { - "Node name for S&R": "ControlNetApplyAdvanced" - }, - "widgets_values": [ - 1.5, - 0.30000000000000004, - 0.8999090576171881 - ] - }, { "id": 24, "type": "ImageUpscaleWithModel", @@ -760,7 +525,7 @@ "1": 46 }, "flags": {}, - "order": 25, + "order": 21, "mode": 0, "inputs": [ { @@ -801,7 +566,7 @@ "1": 46 }, "flags": {}, - "order": 24, + "order": 20, "mode": 0, "inputs": [ { @@ -832,407 +597,384 @@ } }, { - "id": 47, - "type": "SeargeIntegerConstant", + "id": 48, + "type": "SaveImage", "pos": [ - 610, - 710 + 2024, + 709 ], "size": { - "0": 315, - "1": 58 + "0": 594.291259765625, + "1": 605.5518798828125 }, "flags": {}, - "order": 3, + "order": 23, "mode": 0, - "outputs": [ + "inputs": [ { - "name": "value", - "type": "INT", - "links": [ - 107, - 108, - 109 - ], - "shape": 3, - "slot_index": 0 + "name": "images", + "type": "IMAGE", + "link": 112 } ], - "properties": { - "Node name for S&R": "SeargeIntegerConstant" - }, + "properties": {}, "widgets_values": [ - 768 + "qrcode_%date:MM_dd_yyyy%/qr_hires_" ] }, { - "id": 42, - "type": "Get Image Size", + "id": 49, + "type": "SaveImage", "pos": [ - 460, - 810 + 2453.0990710449205, + 58.733161468505756 ], "size": { - "0": 210, - "1": 46 + "0": 342.85223388671875, + "1": 310.2010803222656 }, "flags": {}, - "order": 10, + "order": 22, "mode": 0, "inputs": [ { - "name": "image", + "name": "images", "type": "IMAGE", - "link": 90 + "link": 113 } ], - "outputs": [ - { - "name": "INT", - "type": "INT", - "links": [ - 92 - ], - "shape": 3, - "slot_index": 0 - }, + "properties": {}, + "widgets_values": [ + "qrcode_%date:MM_dd_yyyy%/qr_lores_" + ] + }, + { + "id": 35, + "type": "PreviewImage", + "pos": [ + 960, + 774 + ], + "size": { + "0": 210, + "1": 246 + }, + "flags": {}, + "order": 15, + "mode": 0, + "inputs": [ { - "name": "INT", - "type": "INT", - "links": null, - "shape": 3 + "name": "images", + "type": "IMAGE", + "link": 115 } ], "properties": { - "Node name for S&R": "Get Image Size" + "Node name for S&R": "PreviewImage" } }, { - "id": 44, - "type": "SeargeIntegerMath", + "id": 8, + "type": "EmptyLatentImage", "pos": [ - 500, - 920 + 1155, + 528 ], "size": { "0": 315, - "1": 130 + "1": 106 }, "flags": {}, - "order": 16, + "order": 17, "mode": 0, "inputs": [ { - "name": "c", + "name": "width", "type": "INT", - "link": 92, + "link": 117, "widget": { - "name": "c", + "name": "width", "config": [ "INT", { - "default": 0, - "min": 0, - "max": 18446744073709552000 + "default": 512, + "min": 64, + "max": 8192, + "step": 8 } ] } }, { - "name": "a", + "name": "height", "type": "INT", - "link": 109, + "link": 116, "widget": { - "name": "a", + "name": "height", "config": [ "INT", { - "default": 0, - "min": 0, - "max": 18446744073709552000 + "default": 512, + "min": 64, + "max": 8192, + "step": 8 } ] - } + }, + "slot_index": 1 } ], "outputs": [ { - "name": "result", - "type": "INT", + "name": "LATENT", + "type": "LATENT", "links": [ - 93 + 36 ], "shape": 3, "slot_index": 0 } ], "properties": { - "Node name for S&R": "SeargeIntegerMath" + "Node name for S&R": "EmptyLatentImage" }, "widgets_values": [ - "a - c", 768, - 1, - 0 + 768, + 1 ] }, { - "id": 45, - "type": "SeargeIntegerMath", + "id": 50, + "type": "Reroute", "pos": [ - 680, - 1130 + 934.6552751580807, + 571.8623879092405 + ], + "size": [ + 75, + 26 ], - "size": { - "0": 315, - "1": 130 - }, "flags": {}, - "order": 17, + "order": 9, "mode": 0, "inputs": [ { - "name": "a", - "type": "INT", - "link": 93, - "widget": { - "name": "a", - "config": [ - "INT", - { - "default": 0, - "min": 0, - "max": 18446744073709552000 - } - ] - } + "name": "", + "type": "*", + "link": 118 } ], "outputs": [ { - "name": "result", + "name": "", "type": "INT", "links": [ - 100, - 101, - 102, - 103 + 116, + 117 ], - "shape": 3, "slot_index": 0 } ], "properties": { - "Node name for S&R": "SeargeIntegerMath" - }, - "widgets_values": [ - "a / b", - 512, - 2, - 0 - ] + "showOutputText": false, + "horizontal": false + } }, { - "id": 39, - "type": "Create QR Code", + "id": 47, + "type": "SeargeIntegerConstant", "pos": [ - 2, - 767 + 25, + 585 ], "size": { - "0": 400, - "1": 220.00001525878906 + "0": 315, + "1": 58 }, "flags": {}, - "order": 4, + "order": 3, "mode": 0, "outputs": [ { - "name": "IMAGE", - "type": "IMAGE", + "name": "value", + "type": "INT", "links": [ - 90, - 106 + 114, + 118 ], "shape": 3, "slot_index": 0 } ], "properties": { - "Node name for S&R": "Create QR Code" + "Node name for S&R": "SeargeIntegerConstant" }, "widgets_values": [ - "Snowy Mountain Cabin", - "False", - 512, - 2, - "H", - 16, - 1 + 768 ] }, { - "id": 46, - "type": "Image Pad", + "id": 10, + "type": "ControlNetApplyAdvanced", "pos": [ - 930, - 830 + 1219, + 281 ], "size": { "0": 315, - "1": 154 + "1": 166 }, "flags": {}, "order": 18, "mode": 0, "inputs": [ { - "name": "image", - "type": "IMAGE", - "link": 106 - }, - { - "name": "top", - "type": "INT", - "link": 100, - "widget": { - "name": "top", - "config": [ - "INT", - { - "default": 32, - "min": 0, - "max": 4096, - "step": 1 - } - ] - } + "name": "positive", + "type": "CONDITIONING", + "link": 14, + "slot_index": 0 }, { - "name": "bottom", - "type": "INT", - "link": 101, - "widget": { - "name": "bottom", - "config": [ - "INT", - { - "default": 32, - "min": 0, - "max": 4096, - "step": 1 - } - ] - } + "name": "negative", + "type": "CONDITIONING", + "link": 43, + "slot_index": 1 }, { - "name": "left", - "type": "INT", - "link": 102, - "widget": { - "name": "left", - "config": [ - "INT", - { - "default": 32, - "min": 0, - "max": 4096, - "step": 1 - } - ] - } + "name": "control_net", + "type": "CONTROL_NET", + "link": 26, + "slot_index": 2 }, { - "name": "right", - "type": "INT", - "link": 103, - "widget": { - "name": "right", - "config": [ - "INT", - { - "default": 32, - "min": 0, - "max": 4096, - "step": 1 - } - ] - } + "name": "image", + "type": "IMAGE", + "link": 29 } ], "outputs": [ { - "name": "IMAGE", - "type": "IMAGE", + "name": "positive", + "type": "CONDITIONING", "links": [ - 104, - 105 + 17 ], "shape": 3, "slot_index": 0 + }, + { + "name": "negative", + "type": "CONDITIONING", + "links": [ + 44 + ], + "shape": 3, + "slot_index": 1 } ], "properties": { - "Node name for S&R": "Image Pad" + "Node name for S&R": "ControlNetApplyAdvanced" }, "widgets_values": [ - 32, - 32, - 32, - 32, - "Grey" + 1.5, + 0.30000000000000004, + 0.8999090576171881 ] }, { - "id": 48, - "type": "SaveImage", + "id": 20, + "type": "Reroute", "pos": [ - 2024, - 709 + 963, + 517 + ], + "size": [ + 75, + 26 ], - "size": { - "0": 594.291259765625, - "1": 605.5518798828125 - }, "flags": {}, - "order": 27, + "order": 16, "mode": 0, "inputs": [ { - "name": "images", + "name": "", + "type": "*", + "link": 120 + } + ], + "outputs": [ + { + "name": "", "type": "IMAGE", - "link": 112 + "links": [ + 29 + ], + "slot_index": 0 } ], - "properties": {}, - "widgets_values": [ - "qrcode_%date:MM_dd_yyyy%/qr_hires_" - ] + "properties": { + "showOutputText": false, + "horizontal": false + } }, { - "id": 49, - "type": "SaveImage", + "id": 39, + "type": "Create QR Code", "pos": [ - 2453.0990710449205, - 58.733161468505756 + 317, + 784 ], "size": [ - 342.8522340249792, - 310.20108721760175 + 400, + 244 ], "flags": {}, - "order": 26, + "order": 8, "mode": 0, "inputs": [ { - "name": "images", + "name": "size", + "type": "INT", + "link": 114, + "widget": { + "name": "size", + "config": [ + "INT", + { + "default": 512, + "min": 64, + "max": 4096, + "step": 64 + } + ] + } + } + ], + "outputs": [ + { + "name": "IMAGE", "type": "IMAGE", - "link": 113 + "links": [ + 115, + 120 + ], + "shape": 3, + "slot_index": 0 } ], - "properties": {}, + "properties": { + "Node name for S&R": "Create QR Code" + }, "widgets_values": [ - "qrcode_%date:MM_dd_yyyy%/qr_lores_" + "Snowy Mountain Cabin", + "Pad", + 512, + 2, + "H", + 16, + 1, + "Grey" ] } ], @@ -1325,14 +1067,6 @@ 2, "CONTROL_NET" ], - [ - 28, - 19, - 0, - 20, - 0, - "*" - ], [ 29, 20, @@ -1406,132 +1140,76 @@ "CONDITIONING" ], [ - 90, - 39, - 0, - 42, - 0, - "IMAGE" - ], - [ - 92, - 42, - 0, - 44, - 0, - "INT" - ], - [ - 93, - 44, - 0, - 45, - 0, - "INT" - ], - [ - 100, - 45, + 111, + 13, 0, - 46, + 24, 1, - "INT" - ], - [ - 101, - 45, - 0, - 46, - 2, - "INT" + "IMAGE" ], [ - 102, - 45, + 112, + 24, 0, - 46, - 3, - "INT" - ], - [ - 103, - 45, + 48, 0, - 46, - 4, - "INT" + "IMAGE" ], [ - 104, - 46, + 113, + 13, 0, - 35, + 49, 0, "IMAGE" ], [ - 105, - 46, + 114, + 47, 0, - 19, + 39, 0, - "*" + "INT" ], [ - 106, + 115, 39, 0, - 46, + 35, 0, "IMAGE" ], [ - 107, - 47, + 116, + 50, 0, 8, - 0, + 1, "INT" ], [ - 108, - 47, + 117, + 50, 0, 8, - 1, - "INT" - ], - [ - 109, - 47, 0, - 44, - 1, "INT" ], [ - 111, - 13, - 0, - 24, - 1, - "IMAGE" - ], - [ - 112, - 24, + 118, + 47, 0, - 48, + 50, 0, - "IMAGE" + "*" ], [ - 113, - 13, + 120, + 39, 0, - 49, + 20, 0, - "IMAGE" + "*" ] ], "groups": [],