diff --git a/README.md b/README.md index 5ce049c..b43b721 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,20 @@ comfyui's gaffer **tips**:The node from [kijai-ComfyUI-IC-Light](https://github.com/kijai/ComfyUI-IC-Light) project +* **Gray Scaler Node** + + Scales the image area to gray according to the provided mask. + + ![Gray Scaler Node](image/node_gray-scaler.png) +* + input: + * image: transparent background image. + * mask: mask indicating areas to be converted to grey. + + output: + * image: gray background image. + + ## Credits * [IC-Light](https://github.com/lllyasviel/IC-Light) diff --git a/examples/workflow-gaffer-iclight-all.json b/examples/workflow-gaffer-iclight-all.json index a35e492..8ae372b 100644 --- a/examples/workflow-gaffer-iclight-all.json +++ b/examples/workflow-gaffer-iclight-all.json @@ -1,6 +1,6 @@ { - "last_node_id": 86, - "last_link_id": 216, + "last_node_id": 87, + "last_link_id": 223, "nodes": [ { "id": 49, @@ -84,48 +84,6 @@ "Node name for S&R": "ImageBatch" } }, - { - "id": 51, - "type": "ImageBatch", - "pos": [ - 55.66072852326968, - 1904.0930787287589 - ], - "size": { - "0": 210, - "1": 46 - }, - "flags": {}, - "order": 24, - "mode": 0, - "inputs": [ - { - "name": "image1", - "type": "IMAGE", - "link": 95 - }, - { - "name": "image2", - "type": "IMAGE", - "link": 96 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 97, - 99 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "ImageBatch" - } - }, { "id": 46, "type": "LightSource", @@ -360,59 +318,6 @@ "fixed" ] }, - { - "id": 66, - "type": "EmptyImage", - "pos": [ - -483.05233047540605, - 1238.4874113477158 - ], - "size": { - "0": 315, - "1": 130 - }, - "flags": {}, - "order": 17, - "mode": 0, - "inputs": [ - { - "name": "width", - "type": "INT", - "link": 159, - "widget": { - "name": "width" - } - }, - { - "name": "height", - "type": "INT", - "link": 160, - "widget": { - "name": "height" - } - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 161 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "EmptyImage" - }, - "widgets_values": [ - 512, - 512, - 1, - 8355711 - ] - }, { "id": 42, "type": "LightSource", @@ -543,8 +448,7 @@ "name": "IMAGE", "type": "IMAGE", "links": [ - 158, - 162 + 158 ], "shape": 3, "slot_index": 0 @@ -557,7 +461,6 @@ 86, 87, 89, - 159, 167 ], "shape": 3, @@ -571,7 +474,6 @@ 85, 88, 90, - 160, 168 ], "shape": 3, @@ -590,81 +492,6 @@ 8 ] }, - { - "id": 70, - "type": "ImageResize+", - "pos": [ - -552.5682843054999, - 2785.7466924653672 - ], - "size": { - "0": 315, - "1": 218 - }, - "flags": {}, - "order": 18, - "mode": 0, - "inputs": [ - { - "name": "image", - "type": "IMAGE", - "link": 166 - }, - { - "name": "width", - "type": "INT", - "link": 167, - "widget": { - "name": "width" - } - }, - { - "name": "height", - "type": "INT", - "link": 168, - "widget": { - "name": "height" - } - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 169, - 181 - ], - "shape": 3, - "slot_index": 0 - }, - { - "name": "width", - "type": "INT", - "links": [], - "shape": 3, - "slot_index": 1 - }, - { - "name": "height", - "type": "INT", - "links": [], - "shape": 3, - "slot_index": 2 - } - ], - "properties": { - "Node name for S&R": "ImageResize+" - }, - "widgets_values": [ - 512, - 0, - "nearest", - false, - "always", - 8 - ] - }, { "id": 9, "type": "LoadImage", @@ -776,55 +603,6 @@ "CPU" ] }, - { - "id": 64, - "type": "ImageRemoveBackground+", - "pos": [ - -83.05233047540592, - 898.4874113477166 - ], - "size": { - "0": 241.79998779296875, - "1": 46 - }, - "flags": {}, - "order": 12, - "mode": 0, - "inputs": [ - { - "name": "rembg_session", - "type": "REMBG_SESSION", - "link": 157, - "slot_index": 0 - }, - { - "name": "image", - "type": "IMAGE", - "link": 158 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [], - "shape": 3, - "slot_index": 0 - }, - { - "name": "MASK", - "type": "MASK", - "links": [ - 163 - ], - "shape": 3, - "slot_index": 1 - } - ], - "properties": { - "Node name for S&R": "ImageRemoveBackground+" - } - }, { "id": 62, "type": "ApplyICLight", @@ -837,7 +615,7 @@ "1": 178 }, "flags": {}, - "order": 26, + "order": 23, "mode": 0, "inputs": [ { @@ -868,7 +646,7 @@ { "name": "fg_pixels", "type": "IMAGE", - "link": 165 + "link": 221 }, { "name": "bg_pixels", @@ -932,7 +710,7 @@ 26 ], "flags": {}, - "order": 19, + "order": 18, "mode": 0, "inputs": [ { @@ -969,7 +747,7 @@ "1": 46 }, "flags": {}, - "order": 33, + "order": 32, "mode": 0, "inputs": [ { @@ -1012,7 +790,7 @@ "1": 474 }, "flags": {}, - "order": 31, + "order": 30, "mode": 0, "inputs": [ { @@ -1072,7 +850,7 @@ "1": 581.5648803710938 }, "flags": {}, - "order": 35, + "order": 33, "mode": 0, "inputs": [ { @@ -1097,7 +875,7 @@ "1": 102 }, "flags": {}, - "order": 36, + "order": 34, "mode": 0, "inputs": [ { @@ -1144,7 +922,7 @@ "1": 577.4949951171875 }, "flags": {}, - "order": 37, + "order": 35, "mode": 0, "inputs": [ { @@ -1296,7 +1074,7 @@ "1": 474 }, "flags": {}, - "order": 30, + "order": 26, "mode": 0, "inputs": [ { @@ -1356,7 +1134,7 @@ "1": 46 }, "flags": {}, - "order": 32, + "order": 29, "mode": 0, "inputs": [ { @@ -1398,7 +1176,7 @@ "1": 180 }, "flags": {}, - "order": 27, + "order": 24, "mode": 0, "inputs": [ { @@ -1429,7 +1207,7 @@ { "name": "fg_pixels", "type": "IMAGE", - "link": 204 + "link": 223 }, { "name": "bg_pixels", @@ -1484,31 +1262,6 @@ "color": "#432", "bgcolor": "#653" }, - { - "id": 71, - "type": "PreviewImage", - "pos": [ - -126, - 2895.81723149187 - ], - "size": { - "0": 210, - "1": 246 - }, - "flags": {}, - "order": 23, - "mode": 0, - "inputs": [ - { - "name": "images", - "type": "IMAGE", - "link": 169 - } - ], - "properties": { - "Node name for S&R": "PreviewImage" - } - }, { "id": 79, "type": "PreviewImage", @@ -1521,7 +1274,7 @@ "1": 489.39794921875 }, "flags": {}, - "order": 34, + "order": 31, "mode": 0, "inputs": [ { @@ -1546,7 +1299,7 @@ "1": 339.7276611328125 }, "flags": {}, - "order": 28, + "order": 27, "mode": 0, "inputs": [ { @@ -1559,84 +1312,6 @@ "Node name for S&R": "PreviewImage" } }, - { - "id": 67, - "type": "ImageCompositeMasked", - "pos": [ - -83, - 993 - ], - "size": { - "0": 315, - "1": 146 - }, - "flags": {}, - "order": 22, - "mode": 0, - "inputs": [ - { - "name": "destination", - "type": "IMAGE", - "link": 161 - }, - { - "name": "source", - "type": "IMAGE", - "link": 162 - }, - { - "name": "mask", - "type": "MASK", - "link": 163 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 164, - 165, - 204 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "ImageCompositeMasked" - }, - "widgets_values": [ - 0, - 0, - false - ] - }, - { - "id": 68, - "type": "PreviewImage", - "pos": [ - 13, - 1187 - ], - "size": { - "0": 210, - "1": 246 - }, - "flags": {}, - "order": 25, - "mode": 0, - "inputs": [ - { - "name": "images", - "type": "IMAGE", - "link": 164 - } - ], - "properties": { - "Node name for S&R": "PreviewImage" - } - }, { "id": 39, "type": "CLIPTextEncode", @@ -1757,7 +1432,7 @@ "1": 46.57838821411133 }, "flags": {}, - "order": 29, + "order": 28, "mode": 0, "inputs": [ { @@ -1787,6 +1462,241 @@ "properties": { "Node name for S&R": "VAEEncode" } + }, + { + "id": 64, + "type": "ImageRemoveBackground+", + "pos": [ + -83, + 898 + ], + "size": { + "0": 241.79998779296875, + "1": 46 + }, + "flags": {}, + "order": 12, + "mode": 0, + "inputs": [ + { + "name": "rembg_session", + "type": "REMBG_SESSION", + "link": 157, + "slot_index": 0 + }, + { + "name": "image", + "type": "IMAGE", + "link": 158 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 218 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "MASK", + "type": "MASK", + "links": [ + 219 + ], + "shape": 3, + "slot_index": 1 + } + ], + "properties": { + "Node name for S&R": "ImageRemoveBackground+" + } + }, + { + "id": 68, + "type": "PreviewImage", + "pos": [ + 26, + 1153 + ], + "size": { + "0": 210, + "1": 246 + }, + "flags": {}, + "order": 22, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 220 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 70, + "type": "ImageResize+", + "pos": [ + -552, + 2788 + ], + "size": { + "0": 315, + "1": 218 + }, + "flags": {}, + "order": 17, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 166 + }, + { + "name": "width", + "type": "INT", + "link": 167, + "widget": { + "name": "width" + } + }, + { + "name": "height", + "type": "INT", + "link": 168, + "widget": { + "name": "height" + } + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 181 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "width", + "type": "INT", + "links": [], + "shape": 3, + "slot_index": 1 + }, + { + "name": "height", + "type": "INT", + "links": [], + "shape": 3, + "slot_index": 2 + } + ], + "properties": { + "Node name for S&R": "ImageResize+" + }, + "widgets_values": [ + 512, + 0, + "nearest", + false, + "always", + 8 + ] + }, + { + "id": 51, + "type": "ImageBatch", + "pos": [ + 55.66072852326968, + 1904.0930787287589 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 25, + "mode": 0, + "inputs": [ + { + "name": "image1", + "type": "IMAGE", + "link": 95 + }, + { + "name": "image2", + "type": "IMAGE", + "link": 96 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 97, + 99 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ImageBatch" + } + }, + { + "id": 87, + "type": "GrayScaler", + "pos": [ + 26.622604713618784, + 1027.751508657359 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 19, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 218 + }, + { + "name": "mask", + "type": "MASK", + "link": 219 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 220, + 221, + 223 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "GrayScaler" + } } ], "links": [ @@ -2078,62 +1988,6 @@ 1, "IMAGE" ], - [ - 159, - 28, - 1, - 66, - 0, - "INT" - ], - [ - 160, - 28, - 2, - 66, - 1, - "INT" - ], - [ - 161, - 66, - 0, - 67, - 0, - "IMAGE" - ], - [ - 162, - 28, - 0, - 67, - 1, - "IMAGE" - ], - [ - 163, - 64, - 1, - 67, - 2, - "MASK" - ], - [ - 164, - 67, - 0, - 68, - 0, - "IMAGE" - ], - [ - 165, - 67, - 0, - 62, - 5, - "IMAGE" - ], [ 166, 69, @@ -2158,14 +2012,6 @@ 2, "INT" ], - [ - 169, - 70, - 0, - 71, - 0, - "IMAGE" - ], [ 173, 74, @@ -2238,14 +2084,6 @@ 0, "IMAGE" ], - [ - 204, - 67, - 0, - 75, - 5, - "IMAGE" - ], [ 205, 6, @@ -2333,6 +2171,46 @@ 77, 3, "LATENT" + ], + [ + 218, + 64, + 0, + 87, + 0, + "IMAGE" + ], + [ + 219, + 64, + 1, + 87, + 1, + "MASK" + ], + [ + 220, + 87, + 0, + 68, + 0, + "IMAGE" + ], + [ + 221, + 87, + 0, + 62, + 5, + "IMAGE" + ], + [ + 223, + 87, + 0, + 75, + 5, + "IMAGE" ] ], "groups": [ @@ -2400,10 +2278,10 @@ "config": {}, "extra": { "ds": { - "scale": 0.3855432894295333, + "scale": 0.3504938994813927, "offset": { - "0": 2110.4955805851732, - "1": -71.88922144126275 + "0": 2414.1013859142877, + "1": -121.76160245431333 } } }, diff --git a/examples/workflow-gaffer-iclight-fbc.json b/examples/workflow-gaffer-iclight-fbc.json index 121ca1e..c4fb606 100644 --- a/examples/workflow-gaffer-iclight-fbc.json +++ b/examples/workflow-gaffer-iclight-fbc.json @@ -1,6 +1,6 @@ { - "last_node_id": 87, - "last_link_id": 221, + "last_node_id": 88, + "last_link_id": 226, "nodes": [ { "id": 28, @@ -14,7 +14,7 @@ "1": 218 }, "flags": {}, - "order": 6, + "order": 8, "mode": 0, "inputs": [ { @@ -28,8 +28,7 @@ "name": "IMAGE", "type": "IMAGE", "links": [ - 158, - 162 + 158 ], "shape": 3, "slot_index": 0 @@ -37,18 +36,14 @@ { "name": "width", "type": "INT", - "links": [ - 159 - ], + "links": [], "shape": 3, "slot_index": 1 }, { "name": "height", "type": "INT", - "links": [ - 160 - ], + "links": [], "shape": 3, "slot_index": 2 } @@ -77,7 +72,7 @@ "1": 200 }, "flags": {}, - "order": 8, + "order": 7, "mode": 0, "inputs": [ { @@ -104,107 +99,6 @@ "lowres, bad anatomy, bad hands, cropped, worst quality" ] }, - { - "id": 64, - "type": "ImageRemoveBackground+", - "pos": [ - 133.3849637085923, - 906.8616135979687 - ], - "size": { - "0": 241.79998779296875, - "1": 46 - }, - "flags": {}, - "order": 9, - "mode": 0, - "inputs": [ - { - "name": "rembg_session", - "type": "REMBG_SESSION", - "link": 157, - "slot_index": 0 - }, - { - "name": "image", - "type": "IMAGE", - "link": 158 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [], - "shape": 3, - "slot_index": 0 - }, - { - "name": "MASK", - "type": "MASK", - "links": [ - 163 - ], - "shape": 3, - "slot_index": 1 - } - ], - "properties": { - "Node name for S&R": "ImageRemoveBackground+" - } - }, - { - "id": 67, - "type": "ImageCompositeMasked", - "pos": [ - 133.3849637085923, - 996.8616135979687 - ], - "size": { - "0": 315, - "1": 146 - }, - "flags": {}, - "order": 11, - "mode": 0, - "inputs": [ - { - "name": "destination", - "type": "IMAGE", - "link": 161 - }, - { - "name": "source", - "type": "IMAGE", - "link": 162 - }, - { - "name": "mask", - "type": "MASK", - "link": 163 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 164, - 204 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "ImageCompositeMasked" - }, - "widgets_values": [ - 0, - 0, - false - ] - }, { "id": 68, "type": "PreviewImage", @@ -217,13 +111,13 @@ "1": 246 }, "flags": {}, - "order": 12, + "order": 11, "mode": 0, "inputs": [ { "name": "images", "type": "IMAGE", - "link": 164 + "link": 225 } ], "properties": { @@ -276,7 +170,7 @@ "1": 474 }, "flags": {}, - "order": 14, + "order": 13, "mode": 0, "inputs": [ { @@ -324,45 +218,6 @@ 1 ] }, - { - "id": 9, - "type": "LoadImage", - "pos": [ - -676.615036291409, - 836.8616135979687 - ], - "size": { - "0": 315, - "1": 314.0000305175781 - }, - "flags": {}, - "order": 1, - "mode": 0, - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 123 - ], - "shape": 3, - "slot_index": 0 - }, - { - "name": "MASK", - "type": "MASK", - "links": null, - "shape": 3 - } - ], - "properties": { - "Node name for S&R": "LoadImage" - }, - "widgets_values": [ - "9041719fd893b223a3c94ec6c7a49245 (1).jpg", - "image" - ] - }, { "id": 6, "type": "CheckpointLoaderSimple", @@ -375,7 +230,7 @@ "1": 98 }, "flags": {}, - "order": 2, + "order": 1, "mode": 0, "outputs": [ { @@ -427,7 +282,7 @@ "1": 46 }, "flags": {}, - "order": 15, + "order": 14, "mode": 0, "inputs": [ { @@ -469,7 +324,7 @@ "1": 489.39794921875 }, "flags": {}, - "order": 16, + "order": 15, "mode": 0, "inputs": [ { @@ -494,7 +349,7 @@ "1": 200 }, "flags": {}, - "order": 7, + "order": 6, "mode": 0, "inputs": [ { @@ -521,6 +376,233 @@ "beautiful woman, sunshine" ] }, + { + "id": 87, + "type": "Note", + "pos": [ + -753, + 28 + ], + "size": { + "0": 884.5147094726562, + "1": 616.7295532226562 + }, + "flags": {}, + "order": 2, + "mode": 0, + "properties": { + "text": "" + }, + "widgets_values": [ + "beautiful woman, cinematic lighting\n\n\nstatue of an angel, natural lighting\n\n\nbeautiful woman, cinematic lighting\n\n\nhandsome man, cinematic lighting" + ], + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 64, + "type": "ImageRemoveBackground+", + "pos": [ + 133.3849637085923, + 906.8616135979687 + ], + "size": { + "0": 241.79998779296875, + "1": 46 + }, + "flags": {}, + "order": 9, + "mode": 0, + "inputs": [ + { + "name": "rembg_session", + "type": "REMBG_SESSION", + "link": 157, + "slot_index": 0 + }, + { + "name": "image", + "type": "IMAGE", + "link": 158 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 223 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "MASK", + "type": "MASK", + "links": [ + 224 + ], + "shape": 3, + "slot_index": 1 + } + ], + "properties": { + "Node name for S&R": "ImageRemoveBackground+" + } + }, + { + "id": 88, + "type": "GrayScaler", + "pos": [ + 164, + 1023 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 223 + }, + { + "name": "mask", + "type": "MASK", + "link": 224 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 225, + 226 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "GrayScaler" + } + }, + { + "id": 9, + "type": "LoadImage", + "pos": [ + -676.615036291409, + 836.8616135979687 + ], + "size": { + "0": 315, + "1": 314.0000305175781 + }, + "flags": {}, + "order": 3, + "mode": 0, + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 123 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "MASK", + "type": "MASK", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "i4 (2).png", + "image" + ] + }, + { + "id": 65, + "type": "RemBGSession+", + "pos": [ + -266.61503629140856, + 836.8616135979687 + ], + "size": { + "0": 315, + "1": 82 + }, + "flags": {}, + "order": 4, + "mode": 0, + "outputs": [ + { + "name": "REMBG_SESSION", + "type": "REMBG_SESSION", + "links": [ + 157 + ], + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "RemBGSession+" + }, + "widgets_values": [ + "u2net_human_seg: human segmentation", + "CPU" + ] + }, + { + "id": 69, + "type": "LoadImage", + "pos": [ + 229, + 1573 + ], + "size": { + "0": 315, + "1": 314 + }, + "flags": {}, + "order": 5, + "mode": 0, + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 221 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "MASK", + "type": "MASK", + "links": null, + "shape": 3 + } + ], + "title": "Background", + "properties": { + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "1 (2).webp", + "image" + ] + }, { "id": 75, "type": "ApplyICLight", @@ -533,7 +615,7 @@ "1": 180 }, "flags": {}, - "order": 13, + "order": 12, "mode": 0, "inputs": [ { @@ -564,7 +646,7 @@ { "name": "fg_pixels", "type": "IMAGE", - "link": 204 + "link": 226 }, { "name": "bg_pixels", @@ -614,155 +696,7 @@ "Node name for S&R": "ApplyICLight" }, "widgets_values": [ - 1 - ], - "color": "#432", - "bgcolor": "#653" - }, - { - "id": 66, - "type": "EmptyImage", - "pos": [ - -266, - 1237 - ], - "size": { - "0": 315, - "1": 130 - }, - "flags": {}, - "order": 10, - "mode": 0, - "inputs": [ - { - "name": "width", - "type": "INT", - "link": 159, - "widget": { - "name": "width" - } - }, - { - "name": "height", - "type": "INT", - "link": 160, - "widget": { - "name": "height" - } - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 161 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "EmptyImage" - }, - "widgets_values": [ - 512, - 512, - 1, - 8355711 - ] - }, - { - "id": 65, - "type": "RemBGSession+", - "pos": [ - -266.61503629140856, - 836.8616135979687 - ], - "size": { - "0": 315, - "1": 82 - }, - "flags": {}, - "order": 3, - "mode": 0, - "outputs": [ - { - "name": "REMBG_SESSION", - "type": "REMBG_SESSION", - "links": [ - 157 - ], - "shape": 3 - } - ], - "properties": { - "Node name for S&R": "RemBGSession+" - }, - "widgets_values": [ - "isnet-general-use: general purpose", - "CPU" - ] - }, - { - "id": 69, - "type": "LoadImage", - "pos": [ - 229, - 1573 - ], - "size": { - "0": 315, - "1": 314 - }, - "flags": {}, - "order": 4, - "mode": 0, - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 221 - ], - "shape": 3, - "slot_index": 0 - }, - { - "name": "MASK", - "type": "MASK", - "links": null, - "shape": 3 - } - ], - "title": "Background", - "properties": { - "Node name for S&R": "LoadImage" - }, - "widgets_values": [ - "GB0TawfWYAAicYu (5).jpg", - "image" - ] - }, - { - "id": 87, - "type": "Note", - "pos": [ - -753, - 28 - ], - "size": { - "0": 884.5147094726562, - "1": 616.7295532226562 - }, - "flags": {}, - "order": 5, - "mode": 0, - "properties": { - "text": "" - }, - "widgets_values": [ - "beautiful woman, cinematic lighting\n\n\nstatue of an angel, natural lighting\n\n\nbeautiful woman, cinematic lighting\n\n\nhandsome man, cinematic lighting" + 1.2 ], "color": "#432", "bgcolor": "#653" @@ -809,54 +743,6 @@ 1, "IMAGE" ], - [ - 159, - 28, - 1, - 66, - 0, - "INT" - ], - [ - 160, - 28, - 2, - 66, - 1, - "INT" - ], - [ - 161, - 66, - 0, - 67, - 0, - "IMAGE" - ], - [ - 162, - 28, - 0, - 67, - 1, - "IMAGE" - ], - [ - 163, - 64, - 1, - 67, - 2, - "MASK" - ], - [ - 164, - 67, - 0, - 68, - 0, - "IMAGE" - ], [ 173, 74, @@ -921,14 +807,6 @@ 0, "IMAGE" ], - [ - 204, - 67, - 0, - 75, - 5, - "IMAGE" - ], [ 216, 75, @@ -968,6 +846,38 @@ 75, 6, "IMAGE" + ], + [ + 223, + 64, + 0, + 88, + 0, + "IMAGE" + ], + [ + 224, + 64, + 1, + 88, + 1, + "MASK" + ], + [ + 225, + 88, + 0, + 68, + 0, + "IMAGE" + ], + [ + 226, + 88, + 0, + 75, + 5, + "IMAGE" ] ], "groups": [ @@ -987,10 +897,10 @@ "config": {}, "extra": { "ds": { - "scale": 0.5209868481924381, + "scale": 0.5209868481924383, "offset": { - "0": 1305.0520763583781, - "1": 342.284128792987 + "0": 1352.427175693394, + "1": 409.3948869517454 } } }, diff --git a/examples/workflow-gaffer-iclight-fc-normal.json b/examples/workflow-gaffer-iclight-fc-normal.json index 370abea..66f6b67 100644 --- a/examples/workflow-gaffer-iclight-fc-normal.json +++ b/examples/workflow-gaffer-iclight-fc-normal.json @@ -1,6 +1,6 @@ { - "last_node_id": 90, - "last_link_id": 217, + "last_node_id": 91, + "last_link_id": 222, "nodes": [ { "id": 49, @@ -96,7 +96,7 @@ "1": 46 }, "flags": {}, - "order": 20, + "order": 21, "mode": 0, "inputs": [ { @@ -360,59 +360,6 @@ "fixed" ] }, - { - "id": 66, - "type": "EmptyImage", - "pos": [ - -483.05233047540605, - 1238.4874113477158 - ], - "size": { - "0": 315, - "1": 130 - }, - "flags": {}, - "order": 16, - "mode": 0, - "inputs": [ - { - "name": "width", - "type": "INT", - "link": 159, - "widget": { - "name": "width" - } - }, - { - "name": "height", - "type": "INT", - "link": 160, - "widget": { - "name": "height" - } - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 161 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "EmptyImage" - }, - "widgets_values": [ - 512, - 512, - 1, - 8355711 - ] - }, { "id": 42, "type": "LightSource", @@ -504,8 +451,7 @@ "name": "IMAGE", "type": "IMAGE", "links": [ - 158, - 162 + 158 ], "shape": 3, "slot_index": 0 @@ -517,8 +463,7 @@ 79, 86, 87, - 89, - 159 + 89 ], "shape": 3, "slot_index": 1 @@ -530,8 +475,7 @@ 78, 85, 88, - 90, - 160 + 90 ], "shape": 3, "slot_index": 2 @@ -588,150 +532,6 @@ "lowres, bad anatomy, bad hands, cropped, worst quality" ] }, - { - "id": 64, - "type": "ImageRemoveBackground+", - "pos": [ - -83.05233047540592, - 898.4874113477166 - ], - "size": { - "0": 241.79998779296875, - "1": 46 - }, - "flags": {}, - "order": 11, - "mode": 0, - "inputs": [ - { - "name": "rembg_session", - "type": "REMBG_SESSION", - "link": 157, - "slot_index": 0 - }, - { - "name": "image", - "type": "IMAGE", - "link": 158 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [], - "shape": 3, - "slot_index": 0 - }, - { - "name": "MASK", - "type": "MASK", - "links": [ - 163 - ], - "shape": 3, - "slot_index": 1 - } - ], - "properties": { - "Node name for S&R": "ImageRemoveBackground+" - } - }, - { - "id": 62, - "type": "ApplyICLight", - "pos": [ - 831.8661228220033, - 989.5944853880765 - ], - "size": { - "0": 315, - "1": 178 - }, - "flags": {}, - "order": 22, - "mode": 0, - "inputs": [ - { - "name": "model", - "type": "MODEL", - "link": 214 - }, - { - "name": "vae", - "type": "VAE", - "link": 206 - }, - { - "name": "iclight", - "type": "ICLIGHT", - "link": 150 - }, - { - "name": "positive", - "type": "CONDITIONING", - "link": 148 - }, - { - "name": "negative", - "type": "CONDITIONING", - "link": 147 - }, - { - "name": "fg_pixels", - "type": "IMAGE", - "link": 165 - }, - { - "name": "bg_pixels", - "type": "IMAGE", - "link": null - } - ], - "outputs": [ - { - "name": "model", - "type": "MODEL", - "links": [ - 151 - ], - "shape": 3, - "slot_index": 0 - }, - { - "name": "positive", - "type": "CONDITIONING", - "links": [ - 152 - ], - "shape": 3, - "slot_index": 1 - }, - { - "name": "negative", - "type": "CONDITIONING", - "links": [ - 153 - ], - "shape": 3, - "slot_index": 2 - }, - { - "name": "empty_latent", - "type": "LATENT", - "links": null, - "shape": 3 - } - ], - "properties": { - "Node name for S&R": "ApplyICLight" - }, - "widgets_values": [ - 1 - ], - "color": "#432", - "bgcolor": "#653" - }, { "id": 36, "type": "VAEDecode", @@ -744,7 +544,7 @@ "1": 46 }, "flags": {}, - "order": 26, + "order": 25, "mode": 0, "inputs": [ { @@ -787,7 +587,7 @@ "1": 581.5648803710938 }, "flags": {}, - "order": 27, + "order": 26, "mode": 0, "inputs": [ { @@ -800,78 +600,6 @@ "Node name for S&R": "PreviewImage" } }, - { - "id": 63, - "type": "CalculateNormalMap", - "pos": [ - 1691.866122821997, - 1739.594485388076 - ], - "size": { - "0": 315, - "1": 102 - }, - "flags": {}, - "order": 28, - "mode": 0, - "inputs": [ - { - "name": "images", - "type": "IMAGE", - "link": 155 - }, - { - "name": "mask", - "type": "MASK", - "link": null - } - ], - "outputs": [ - { - "name": "normal", - "type": "IMAGE", - "links": [ - 156 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "CalculateNormalMap" - }, - "widgets_values": [ - 10, - false - ], - "color": "#432", - "bgcolor": "#653" - }, - { - "id": 45, - "type": "PreviewImage", - "pos": [ - 2071.8661228219935, - 1739.594485388076 - ], - "size": { - "0": 403.2276611328125, - "1": 577.4949951171875 - }, - "flags": {}, - "order": 29, - "mode": 0, - "inputs": [ - { - "name": "images", - "type": "IMAGE", - "link": 156 - } - ], - "properties": { - "Node name for S&R": "PreviewImage" - } - }, { "id": 6, "type": "CheckpointLoaderSimple", @@ -935,7 +663,7 @@ "1": 339.7276611328125 }, "flags": {}, - "order": 23, + "order": 22, "mode": 0, "inputs": [ { @@ -948,58 +676,6 @@ "Node name for S&R": "PreviewImage" } }, - { - "id": 67, - "type": "ImageCompositeMasked", - "pos": [ - -83, - 993 - ], - "size": { - "0": 315, - "1": 146 - }, - "flags": {}, - "order": 19, - "mode": 0, - "inputs": [ - { - "name": "destination", - "type": "IMAGE", - "link": 161 - }, - { - "name": "source", - "type": "IMAGE", - "link": 162 - }, - { - "name": "mask", - "type": "MASK", - "link": 163 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 164, - 165 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "ImageCompositeMasked" - }, - "widgets_values": [ - 0, - 0, - false - ] - }, { "id": 68, "type": "PreviewImage", @@ -1012,13 +688,13 @@ "1": 246 }, "flags": {}, - "order": 21, + "order": 19, "mode": 0, "inputs": [ { "name": "images", "type": "IMAGE", - "link": 164 + "link": 221 } ], "properties": { @@ -1142,7 +818,7 @@ "1": 474 }, "flags": {}, - "order": 25, + "order": 24, "mode": 0, "inputs": [ { @@ -1351,7 +1027,7 @@ "1": 46.57838821411133 }, "flags": {}, - "order": 24, + "order": 23, "mode": 0, "inputs": [ { @@ -1381,6 +1057,270 @@ "properties": { "Node name for S&R": "VAEEncode" } + }, + { + "id": 91, + "type": "GrayScaler", + "pos": [ + 10, + 1050 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": { + "pinned": true + }, + "order": 16, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 219 + }, + { + "name": "mask", + "type": "MASK", + "link": 220 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 221, + 222 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "GrayScaler" + }, + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 64, + "type": "ImageRemoveBackground+", + "pos": [ + -83, + 898 + ], + "size": { + "0": 241.79998779296875, + "1": 46 + }, + "flags": {}, + "order": 11, + "mode": 0, + "inputs": [ + { + "name": "rembg_session", + "type": "REMBG_SESSION", + "link": 157, + "slot_index": 0 + }, + { + "name": "image", + "type": "IMAGE", + "link": 158 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 219 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "MASK", + "type": "MASK", + "links": [ + 220 + ], + "shape": 3, + "slot_index": 1 + } + ], + "properties": { + "Node name for S&R": "ImageRemoveBackground+" + } + }, + { + "id": 62, + "type": "ApplyICLight", + "pos": [ + 831.8661228220033, + 989.5944853880765 + ], + "size": { + "0": 315, + "1": 178 + }, + "flags": {}, + "order": 20, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 214 + }, + { + "name": "vae", + "type": "VAE", + "link": 206 + }, + { + "name": "iclight", + "type": "ICLIGHT", + "link": 150 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 148 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 147 + }, + { + "name": "fg_pixels", + "type": "IMAGE", + "link": 222 + }, + { + "name": "bg_pixels", + "type": "IMAGE", + "link": null + } + ], + "outputs": [ + { + "name": "model", + "type": "MODEL", + "links": [ + 151 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "positive", + "type": "CONDITIONING", + "links": [ + 152 + ], + "shape": 3, + "slot_index": 1 + }, + { + "name": "negative", + "type": "CONDITIONING", + "links": [ + 153 + ], + "shape": 3, + "slot_index": 2 + }, + { + "name": "empty_latent", + "type": "LATENT", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "ApplyICLight" + }, + "widgets_values": [ + 1.2 + ], + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 63, + "type": "CalculateNormalMap", + "pos": [ + 1635, + 1675 + ], + "size": { + "0": 315, + "1": 102 + }, + "flags": {}, + "order": 27, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 155 + }, + { + "name": "mask", + "type": "MASK", + "link": null + } + ], + "outputs": [ + { + "name": "normal", + "type": "IMAGE", + "links": [ + 156 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "CalculateNormalMap" + }, + "widgets_values": [ + 10, + false + ], + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 45, + "type": "PreviewImage", + "pos": [ + 2064, + 1674 + ], + "size": { + "0": 403.2276611328125, + "1": 577.4949951171875 + }, + "flags": {}, + "order": 28, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 156 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } } ], "links": [ @@ -1672,62 +1612,6 @@ 1, "IMAGE" ], - [ - 159, - 28, - 1, - 66, - 0, - "INT" - ], - [ - 160, - 28, - 2, - 66, - 1, - "INT" - ], - [ - 161, - 66, - 0, - 67, - 0, - "IMAGE" - ], - [ - 162, - 28, - 0, - 67, - 1, - "IMAGE" - ], - [ - 163, - 64, - 1, - 67, - 2, - "MASK" - ], - [ - 164, - 67, - 0, - 68, - 0, - "IMAGE" - ], - [ - 165, - 67, - 0, - 62, - 5, - "IMAGE" - ], [ 205, 6, @@ -1783,6 +1667,38 @@ 62, 0, "MODEL" + ], + [ + 219, + 64, + 0, + 91, + 0, + "IMAGE" + ], + [ + 220, + 64, + 1, + 91, + 1, + "MASK" + ], + [ + 221, + 91, + 0, + 68, + 0, + "IMAGE" + ], + [ + 222, + 91, + 0, + 62, + 5, + "IMAGE" ] ], "groups": [ @@ -1826,10 +1742,10 @@ "config": {}, "extra": { "ds": { - "scale": 0.385543289429532, + "scale": 0.35049389948139237, "offset": { - "0": 1761.6205311022047, - "1": 262.45123908624777 + "0": 2220.7743800231146, + "1": 321.1031645390776 } } }, diff --git a/examples/workflow-gaffer-iclight-fc-text.json b/examples/workflow-gaffer-iclight-fc-text.json index 50d3819..e0aea20 100644 --- a/examples/workflow-gaffer-iclight-fc-text.json +++ b/examples/workflow-gaffer-iclight-fc-text.json @@ -1,6 +1,6 @@ { - "last_node_id": 91, - "last_link_id": 229, + "last_node_id": 93, + "last_link_id": 235, "nodes": [ { "id": 40, @@ -41,82 +41,6 @@ "lowres, bad anatomy, bad hands, cropped, worst quality" ] }, - { - "id": 67, - "type": "ImageCompositeMasked", - "pos": [ - 133.38502474374852, - 994.9773755650289 - ], - "size": { - "0": 315, - "1": 146 - }, - "flags": {}, - "order": 12, - "mode": 0, - "inputs": [ - { - "name": "destination", - "type": "IMAGE", - "link": 161 - }, - { - "name": "source", - "type": "IMAGE", - "link": 227 - }, - { - "name": "mask", - "type": "MASK", - "link": 228 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 164 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "ImageCompositeMasked" - }, - "widgets_values": [ - 0, - 0, - false - ] - }, - { - "id": 68, - "type": "PreviewImage", - "pos": [ - 223.3850247437484, - 1194.9773755650288 - ], - "size": { - "0": 210, - "1": 246 - }, - "flags": {}, - "order": 14, - "mode": 0, - "inputs": [ - { - "name": "images", - "type": "IMAGE", - "link": 164 - } - ], - "properties": { - "Node name for S&R": "PreviewImage" - } - }, { "id": 78, "type": "VAEDecode", @@ -171,7 +95,7 @@ "1": 489.39794921875 }, "flags": {}, - "order": 15, + "order": 14, "mode": 0, "inputs": [ { @@ -184,157 +108,6 @@ "Node name for S&R": "PreviewImage" } }, - { - "id": 66, - "type": "EmptyImage", - "pos": [ - -265.9999389648437, - 1235.11576196706 - ], - "size": { - "0": 315, - "1": 130 - }, - "flags": {}, - "order": 10, - "mode": 0, - "inputs": [ - { - "name": "width", - "type": "INT", - "link": 159, - "widget": { - "name": "width" - } - }, - { - "name": "height", - "type": "INT", - "link": 160, - "widget": { - "name": "height" - } - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 161 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "EmptyImage" - }, - "widgets_values": [ - 512, - 512, - 1, - 8355711 - ] - }, - { - "id": 75, - "type": "ApplyICLight", - "pos": [ - 876, - 896 - ], - "size": { - "0": 320, - "1": 180 - }, - "flags": {}, - "order": 9, - "mode": 0, - "inputs": [ - { - "name": "model", - "type": "MODEL", - "link": 219 - }, - { - "name": "vae", - "type": "VAE", - "link": 218 - }, - { - "name": "iclight", - "type": "ICLIGHT", - "link": 173 - }, - { - "name": "positive", - "type": "CONDITIONING", - "link": 174 - }, - { - "name": "negative", - "type": "CONDITIONING", - "link": 175 - }, - { - "name": "fg_pixels", - "type": "IMAGE", - "link": 229 - }, - { - "name": "bg_pixels", - "type": "IMAGE", - "link": null - } - ], - "outputs": [ - { - "name": "model", - "type": "MODEL", - "links": [ - 185 - ], - "shape": 3, - "slot_index": 0 - }, - { - "name": "positive", - "type": "CONDITIONING", - "links": [ - 186 - ], - "shape": 3, - "slot_index": 1 - }, - { - "name": "negative", - "type": "CONDITIONING", - "links": [ - 187 - ], - "shape": 3, - "slot_index": 2 - }, - { - "name": "empty_latent", - "type": "LATENT", - "links": [ - 216 - ], - "shape": 3, - "slot_index": 3 - } - ], - "properties": { - "Node name for S&R": "ApplyICLight" - }, - "widgets_values": [ - 1 - ], - "color": "#432", - "bgcolor": "#653" - }, { "id": 74, "type": "ICLightModelLoader", @@ -422,103 +195,50 @@ ] }, { - "id": 65, - "type": "RemBGSession+", + "id": 9, + "type": "LoadImage", "pos": [ - -266.61497525625225, - 834.9773755650289 + -677, + 835 ], "size": { "0": 315, - "1": 82 + "1": 314.0000305175781 }, "flags": {}, "order": 2, "mode": 0, "outputs": [ { - "name": "REMBG_SESSION", - "type": "REMBG_SESSION", + "name": "IMAGE", + "type": "IMAGE", "links": [ - 157 + 123 ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "MASK", + "type": "MASK", + "links": null, "shape": 3 } ], "properties": { - "Node name for S&R": "RemBGSession+" + "Node name for S&R": "LoadImage" }, "widgets_values": [ - "u2netp: lightweight general purpose", - "CPU" - ] - }, - { - "id": 77, - "type": "KSampler", - "pos": [ - 1276, - 896 - ], - "size": { - "0": 320, - "1": 474 - }, - "flags": {}, - "order": 11, - "mode": 0, - "inputs": [ - { - "name": "model", - "type": "MODEL", - "link": 185 - }, - { - "name": "positive", - "type": "CONDITIONING", - "link": 186 - }, - { - "name": "negative", - "type": "CONDITIONING", - "link": 187 - }, - { - "name": "latent_image", - "type": "LATENT", - "link": 216 - } - ], - "outputs": [ - { - "name": "LATENT", - "type": "LATENT", - "links": [ - 189 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "KSampler" - }, - "widgets_values": [ - 995253983530182, - "increment", - 20, - 2, - "euler_ancestral", - "normal", - 1 + "i3 (4).png", + "image" ] }, { "id": 64, "type": "ImageRemoveBackground+", "pos": [ - 133.38502474374852, - 904.9773755650289 + 137, + 890 ], "size": { "0": 241.79998779296875, @@ -544,7 +264,9 @@ { "name": "IMAGE", "type": "IMAGE", - "links": [], + "links": [ + 230 + ], "shape": 3, "slot_index": 0 }, @@ -552,7 +274,7 @@ "name": "MASK", "type": "MASK", "links": [ - 228 + 231 ], "shape": 3, "slot_index": 1 @@ -562,70 +284,6 @@ "Node name for S&R": "ImageRemoveBackground+" } }, - { - "id": 28, - "type": "ImageResize+", - "pos": [ - -266.61497525625225, - 964.9773755650289 - ], - "size": { - "0": 315, - "1": 218 - }, - "flags": {}, - "order": 7, - "mode": 0, - "inputs": [ - { - "name": "image", - "type": "IMAGE", - "link": 123 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 158, - 227, - 229 - ], - "shape": 3, - "slot_index": 0 - }, - { - "name": "width", - "type": "INT", - "links": [ - 159 - ], - "shape": 3, - "slot_index": 1 - }, - { - "name": "height", - "type": "INT", - "links": [ - 160 - ], - "shape": 3, - "slot_index": 2 - } - ], - "properties": { - "Node name for S&R": "ImageResize+" - }, - "widgets_values": [ - 512, - 0, - "nearest", - true, - "always", - 8 - ] - }, { "id": 87, "type": "Note", @@ -685,46 +343,322 @@ "Node name for S&R": "CLIPTextEncode" }, "widgets_values": [ - "Buddha, detailed face, sci-fi RGB glowing, cyberpunk" + "beautiful woman, detailed face, sunshine from window" ] }, { - "id": 9, - "type": "LoadImage", + "id": 28, + "type": "ImageResize+", "pos": [ - -677, - 835 + -266.61497525625225, + 964.9773755650289 ], "size": { "0": 315, - "1": 314.0000305175781 + "1": 218 + }, + "flags": {}, + "order": 7, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 123 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 158 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "width", + "type": "INT", + "links": [], + "shape": 3, + "slot_index": 1 + }, + { + "name": "height", + "type": "INT", + "links": [], + "shape": 3, + "slot_index": 2 + } + ], + "properties": { + "Node name for S&R": "ImageResize+" + }, + "widgets_values": [ + 512, + 0, + "nearest", + true, + "always", + 8 + ] + }, + { + "id": 65, + "type": "RemBGSession+", + "pos": [ + -266.61497525625225, + 834.9773755650289 + ], + "size": { + "0": 315, + "1": 82 }, "flags": {}, "order": 4, "mode": 0, + "outputs": [ + { + "name": "REMBG_SESSION", + "type": "REMBG_SESSION", + "links": [ + 157 + ], + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "RemBGSession+" + }, + "widgets_values": [ + "u2net_human_seg: human segmentation", + "CPU" + ] + }, + { + "id": 93, + "type": "PreviewImage", + "pos": [ + 147, + 1103 + ], + "size": [ + 210, + 246 + ], + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 233 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 92, + "type": "GrayScaler", + "pos": [ + 151, + 995 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 9, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 230 + }, + { + "name": "mask", + "type": "MASK", + "link": 231 + } + ], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [ - 123 + 233, + 235 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "GrayScaler" + } + }, + { + "id": 75, + "type": "ApplyICLight", + "pos": [ + 876, + 896 + ], + "size": { + "0": 320, + "1": 180 + }, + "flags": {}, + "order": 11, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 219 + }, + { + "name": "vae", + "type": "VAE", + "link": 218 + }, + { + "name": "iclight", + "type": "ICLIGHT", + "link": 173 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 174 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 175 + }, + { + "name": "fg_pixels", + "type": "IMAGE", + "link": 235 + }, + { + "name": "bg_pixels", + "type": "IMAGE", + "link": null + } + ], + "outputs": [ + { + "name": "model", + "type": "MODEL", + "links": [ + 185 ], "shape": 3, "slot_index": 0 }, { - "name": "MASK", - "type": "MASK", - "links": null, - "shape": 3 + "name": "positive", + "type": "CONDITIONING", + "links": [ + 186 + ], + "shape": 3, + "slot_index": 1 + }, + { + "name": "negative", + "type": "CONDITIONING", + "links": [ + 187 + ], + "shape": 3, + "slot_index": 2 + }, + { + "name": "empty_latent", + "type": "LATENT", + "links": [ + 216 + ], + "shape": 3, + "slot_index": 3 } ], "properties": { - "Node name for S&R": "LoadImage" + "Node name for S&R": "ApplyICLight" }, "widgets_values": [ - "i3 (4).png", - "image" + 1.3 + ], + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 77, + "type": "KSampler", + "pos": [ + 1276, + 896 + ], + "size": { + "0": 320, + "1": 474 + }, + "flags": {}, + "order": 12, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 185 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 186 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 187 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 216 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 189 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "KSampler" + }, + "widgets_values": [ + 995253983530196, + "fixed", + 20, + 2, + "dpmpp_2m", + "karras", + 1 ] } ], @@ -769,38 +703,6 @@ 1, "IMAGE" ], - [ - 159, - 28, - 1, - 66, - 0, - "INT" - ], - [ - 160, - 28, - 2, - 66, - 1, - "INT" - ], - [ - 161, - 66, - 0, - 67, - 0, - "IMAGE" - ], - [ - 164, - 67, - 0, - 68, - 0, - "IMAGE" - ], [ 173, 74, @@ -898,24 +800,32 @@ "VAE" ], [ - 227, - 28, + 230, + 64, + 0, + 92, 0, - 67, - 1, "IMAGE" ], [ - 228, + 231, 64, 1, - 67, - 2, + 92, + 1, "MASK" ], [ - 229, - 28, + 233, + 92, + 0, + 93, + 0, + "IMAGE" + ], + [ + 235, + 92, 0, 75, 5, @@ -939,10 +849,10 @@ "config": {}, "extra": { "ds": { - "scale": 0.6303940863128713, + "scale": 0.5730855330117124, "offset": { - "0": 1101.0454934374645, - "1": 77.72630364882095 + "0": 1030.3929200078123, + "1": 375.5687335634062 } } }, diff --git a/examples/workflow-gaffer-iclight-fc.json b/examples/workflow-gaffer-iclight-fc.json index ceb9ccd..9e42e8d 100644 --- a/examples/workflow-gaffer-iclight-fc.json +++ b/examples/workflow-gaffer-iclight-fc.json @@ -1,6 +1,6 @@ { - "last_node_id": 87, - "last_link_id": 227, + "last_node_id": 88, + "last_link_id": 231, "nodes": [ { "id": 28, @@ -28,8 +28,7 @@ "name": "IMAGE", "type": "IMAGE", "links": [ - 158, - 162 + 158 ], "shape": 3, "slot_index": 0 @@ -38,8 +37,7 @@ "name": "width", "type": "INT", "links": [ - 79, - 159 + 79 ], "shape": 3, "slot_index": 1 @@ -48,8 +46,7 @@ "name": "height", "type": "INT", "links": [ - 78, - 160 + 78 ], "shape": 3, "slot_index": 2 @@ -67,31 +64,6 @@ 8 ] }, - { - "id": 68, - "type": "PreviewImage", - "pos": [ - 218.49848027265622, - 1221.1887652515625 - ], - "size": { - "0": 210, - "1": 246 - }, - "flags": {}, - "order": 13, - "mode": 0, - "inputs": [ - { - "name": "images", - "type": "IMAGE", - "link": 164 - } - ], - "properties": { - "Node name for S&R": "PreviewImage" - } - }, { "id": 36, "type": "VAEDecode", @@ -104,7 +76,7 @@ "1": 46 }, "flags": {}, - "order": 16, + "order": 15, "mode": 0, "inputs": [ { @@ -134,192 +106,6 @@ "Node name for S&R": "VAEDecode" } }, - { - "id": 65, - "type": "RemBGSession+", - "pos": [ - -601.5015197273425, - 1261.1887652515625 - ], - "size": { - "0": 315, - "1": 82 - }, - "flags": {}, - "order": 0, - "mode": 0, - "outputs": [ - { - "name": "REMBG_SESSION", - "type": "REMBG_SESSION", - "links": [ - 157 - ], - "shape": 3 - } - ], - "properties": { - "Node name for S&R": "RemBGSession+" - }, - "widgets_values": [ - "isnet-general-use: general purpose", - "CPU" - ] - }, - { - "id": 66, - "type": "EmptyImage", - "pos": [ - 128.49848027265617, - 831.1887652515626 - ], - "size": { - "0": 315, - "1": 130 - }, - "flags": {}, - "order": 10, - "mode": 0, - "inputs": [ - { - "name": "width", - "type": "INT", - "link": 159, - "widget": { - "name": "width" - } - }, - { - "name": "height", - "type": "INT", - "link": 160, - "widget": { - "name": "height" - } - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 161 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "EmptyImage" - }, - "widgets_values": [ - 512, - 512, - 1, - 8355711 - ] - }, - { - "id": 67, - "type": "ImageCompositeMasked", - "pos": [ - 128.49848027265617, - 1011.1887652515626 - ], - "size": { - "0": 315, - "1": 146 - }, - "flags": {}, - "order": 12, - "mode": 0, - "inputs": [ - { - "name": "destination", - "type": "IMAGE", - "link": 161 - }, - { - "name": "source", - "type": "IMAGE", - "link": 162 - }, - { - "name": "mask", - "type": "MASK", - "link": 163 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 164, - 165 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "ImageCompositeMasked" - }, - "widgets_values": [ - 0, - 0, - false - ] - }, - { - "id": 64, - "type": "ImageRemoveBackground+", - "pos": [ - -211.50151972734392, - 1271.1887652515625 - ], - "size": { - "0": 241.79998779296875, - "1": 46 - }, - "flags": {}, - "order": 8, - "mode": 0, - "inputs": [ - { - "name": "rembg_session", - "type": "REMBG_SESSION", - "link": 157, - "slot_index": 0 - }, - { - "name": "image", - "type": "IMAGE", - "link": 158 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [], - "shape": 3, - "slot_index": 0 - }, - { - "name": "MASK", - "type": "MASK", - "links": [ - 163 - ], - "shape": 3, - "slot_index": 1 - } - ], - "properties": { - "Node name for S&R": "ImageRemoveBackground+" - } - }, { "id": 40, "type": "CLIPTextEncode", @@ -410,7 +196,7 @@ "1": 98 }, "flags": {}, - "order": 1, + "order": 0, "mode": 0, "outputs": [ { @@ -463,7 +249,7 @@ "1": 58 }, "flags": {}, - "order": 2, + "order": 1, "mode": 0, "outputs": [ { @@ -497,7 +283,7 @@ "1": 581.5648803710938 }, "flags": {}, - "order": 17, + "order": 16, "mode": 0, "inputs": [ { @@ -565,7 +351,7 @@ "1": 474 }, "flags": {}, - "order": 15, + "order": 14, "mode": 0, "inputs": [ { @@ -625,7 +411,7 @@ "1": 178 }, "flags": {}, - "order": 14, + "order": 13, "mode": 0, "inputs": [ { @@ -656,7 +442,7 @@ { "name": "fg_pixels", "type": "IMAGE", - "link": 165 + "link": 231 }, { "name": "bg_pixels", @@ -708,6 +494,218 @@ "color": "#432", "bgcolor": "#653" }, + { + "id": 87, + "type": "Note", + "pos": [ + -758, + 78 + ], + "size": { + "0": 884.5147094726562, + "1": 616.7295532226562 + }, + "flags": {}, + "order": 2, + "mode": 0, + "properties": { + "text": "" + }, + "widgets_values": [ + "beautiful woman, detailed face, sunshine, outdoor, warm atmosphere\n\nbeautiful woman, detailed face, neon, Wong Kar-wai, warm\n\nbeautiful woman, detailed face, sunshine from window\n\nbeautiful woman, detailed face, warm atmosphere, at home, bedroom\n\nbeautiful woman, detailed face, shadow from window\n\nbeautiful woman, detailed face, sunset over sea\n\nbeautiful woman, detailed face, light and shadow\n\nhandsome boy, detailed face, neon light, city\n\nBuddha, detailed face, sci-fi RGB glowing, cyberpunk\n\nBuddha, detailed face, natural lighting\n\ntoy, detailed face, shadow from window\n\ntoy, detailed face, sunset over sea\n\ndog, magic lit, sci-fi RGB glowing, studio lighting\n\nmysteriou human, warm atmosphere, warm atmosphere, at home, bedroom\n\n" + ], + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 9, + "type": "LoadImage", + "pos": [ + -694.7181390945309, + 851.10255243125 + ], + "size": { + "0": 315, + "1": 314.0000305175781 + }, + "flags": {}, + "order": 3, + "mode": 0, + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 123 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "MASK", + "type": "MASK", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "i3 (6).png", + "image" + ] + }, + { + "id": 64, + "type": "ImageRemoveBackground+", + "pos": [ + 194, + 915 + ], + "size": { + "0": 241.79998779296875, + "1": 46 + }, + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [ + { + "name": "rembg_session", + "type": "REMBG_SESSION", + "link": 157, + "slot_index": 0 + }, + { + "name": "image", + "type": "IMAGE", + "link": 158 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 228 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "MASK", + "type": "MASK", + "links": [ + 229 + ], + "shape": 3, + "slot_index": 1 + } + ], + "properties": { + "Node name for S&R": "ImageRemoveBackground+" + } + }, + { + "id": 68, + "type": "PreviewImage", + "pos": [ + 232, + 1146 + ], + "size": { + "0": 210, + "1": 246 + }, + "flags": {}, + "order": 12, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 230 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 88, + "type": "GrayScaler", + "pos": [ + 216, + 1016 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 228 + }, + { + "name": "mask", + "type": "MASK", + "link": 229 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 230, + 231 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "GrayScaler" + } + }, + { + "id": 65, + "type": "RemBGSession+", + "pos": [ + -266, + 834 + ], + "size": { + "0": 315, + "1": 82 + }, + "flags": {}, + "order": 4, + "mode": 0, + "outputs": [ + { + "name": "REMBG_SESSION", + "type": "REMBG_SESSION", + "links": [ + 157 + ], + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "RemBGSession+" + }, + "widgets_values": [ + "u2net_human_seg: human segmentation", + "CPU" + ] + }, { "id": 42, "type": "LightSource", @@ -756,7 +754,7 @@ "Node name for S&R": "LightSource" }, "widgets_values": [ - "Top Light", + "Top Left Light", 1, "#ffffff", "#000000", @@ -765,68 +763,6 @@ ], "color": "#432", "bgcolor": "#653" - }, - { - "id": 9, - "type": "LoadImage", - "pos": [ - -694.7181390945309, - 851.10255243125 - ], - "size": { - "0": 315, - "1": 314.0000305175781 - }, - "flags": {}, - "order": 3, - "mode": 0, - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 123 - ], - "shape": 3, - "slot_index": 0 - }, - { - "name": "MASK", - "type": "MASK", - "links": null, - "shape": 3 - } - ], - "properties": { - "Node name for S&R": "LoadImage" - }, - "widgets_values": [ - "9041719fd893b223a3c94ec6c7a49245.jpg", - "image" - ] - }, - { - "id": 87, - "type": "Note", - "pos": [ - -758, - 78 - ], - "size": { - "0": 884.5147094726562, - "1": 616.7295532226562 - }, - "flags": {}, - "order": 4, - "mode": 0, - "properties": { - "text": "" - }, - "widgets_values": [ - "beautiful woman, detailed face, sunshine, outdoor, warm atmosphere\n\nbeautiful woman, detailed face, neon, Wong Kar-wai, warm\n\nbeautiful woman, detailed face, sunshine from window\n\nbeautiful woman, detailed face, warm atmosphere, at home, bedroom\n\nbeautiful woman, detailed face, shadow from window\n\nbeautiful woman, detailed face, sunset over sea\n\nbeautiful woman, detailed face, light and shadow\n\nhandsome boy, detailed face, neon light, city\n\nBuddha, detailed face, sci-fi RGB glowing, cyberpunk\n\nBuddha, detailed face, natural lighting\n\ntoy, detailed face, shadow from window\n\ntoy, detailed face, sunset over sea\n\ndog, magic lit, sci-fi RGB glowing, studio lighting\n\nmysteriou human, warm atmosphere, warm atmosphere, at home, bedroom\n\n" - ], - "color": "#432", - "bgcolor": "#653" } ], "links": [ @@ -958,62 +894,6 @@ 1, "IMAGE" ], - [ - 159, - 28, - 1, - 66, - 0, - "INT" - ], - [ - 160, - 28, - 2, - 66, - 1, - "INT" - ], - [ - 161, - 66, - 0, - 67, - 0, - "IMAGE" - ], - [ - 162, - 28, - 0, - 67, - 1, - "IMAGE" - ], - [ - 163, - 64, - 1, - 67, - 2, - "MASK" - ], - [ - 164, - 67, - 0, - 68, - 0, - "IMAGE" - ], - [ - 165, - 67, - 0, - 62, - 5, - "IMAGE" - ], [ 221, 42, @@ -1053,6 +933,38 @@ 62, 0, "MODEL" + ], + [ + 228, + 64, + 0, + 88, + 0, + "IMAGE" + ], + [ + 229, + 64, + 1, + 88, + 1, + "MASK" + ], + [ + 230, + 88, + 0, + 68, + 0, + "IMAGE" + ], + [ + 231, + 88, + 0, + 62, + 5, + "IMAGE" ] ], "groups": [ @@ -1074,8 +986,8 @@ "ds": { "scale": 0.5131581182307067, "offset": { - "0": 1564.634237793645, - "1": 85.58901597045116 + "0": 1988.018452815201, + "1": 247.8858309778409 } } }, diff --git a/iclight.py b/iclight.py index 0ff5bd3..29db957 100644 --- a/iclight.py +++ b/iclight.py @@ -423,16 +423,60 @@ class CalculateNormalMap: normal = torch.clamp(normal, 0, 1) return normal +class GrayScaler: + """Class to scale image regions to grey based on provided masks.""" + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": ("IMAGE",), + "mask": ("MASK",), + } + } + + CATEGORY = "gaffer" + RETURN_TYPES = ("IMAGE",) + FUNCTION = "apply" + + def apply(self, image: torch.Tensor, mask: torch.Tensor): + """ + Applies grey scaling to image regions as indicated by the mask. + + Args: + image: torch.Tensor: The input image tensor. + mask: torch.Tensor: A mask tensor where 1 indicates areas to be converted to grey. + + Returns: + tuple: A tuple containing the image with masked regions turned grey. + """ + # Validate inputs + if not isinstance(image, torch.Tensor) or not isinstance(mask, torch.Tensor): + raise ValueError("image and mask must be torch.Tensor types.") + if image.ndim != 4 or mask.ndim not in [3, 4]: + raise ValueError("image must be a 4D tensor, and mask must be a 3D or 4D tensor.") + + # Adjust mask dimensions if necessary + if mask.ndim == 3: + # [B, H, W] => [B, H, W, C=1] + mask = mask.unsqueeze(-1) + + # Apply the mask to the image to turn specified regions grey. + image = image * mask + (1 - mask) * 0.5 + + return (image,) + NODE_CLASS_MAPPINGS = { "ICLightModelLoader": ICLightModelLoader, "ApplyICLight": ApplyICLight, "LightSource": LightSource, - "CalculateNormalMap": CalculateNormalMap + "CalculateNormalMap": CalculateNormalMap, + "GrayScaler": GrayScaler } NODE_DISPLAY_NAME_MAPPINGS = { "ICLightModelLoader": "Load ICLight Model", "ApplyICLight": "Apply ICLight", "LightSource": "Simple Light Source", - "CalculateNormalMap": "Calculate Normal Map" + "CalculateNormalMap": "Calculate Normal Map", + "GrayScaler": "Gray Scaler", } diff --git a/image/node_gray-scaler.png b/image/node_gray-scaler.png new file mode 100644 index 0000000..b3bf512 Binary files /dev/null and b/image/node_gray-scaler.png differ