diff --git a/InsertAnything.json b/InsertAnything.json deleted file mode 100644 index 78fd368..0000000 --- a/InsertAnything.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"628cd5b4-3ba1-4afc-8ff0-bbc6aec39fb7","revision":0,"last_node_id":91,"last_link_id":165,"nodes":[{"id":32,"type":"VAELoader","pos":[1352,422],"size":[315,58],"flags":{},"order":0,"mode":0,"inputs":[{"localized_name":"vae名称","name":"vae_name","type":"COMBO","widget":{"name":"vae_name"},"link":null}],"outputs":[{"localized_name":"VAE","name":"VAE","type":"VAE","slot_index":0,"links":[60,82]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"VAELoader"},"widgets_values":["ae.safetensors"]},{"id":70,"type":"CLIPVisionEncode","pos":[431.2784729003906,-396.73291015625],"size":[290,78],"flags":{},"order":18,"mode":0,"inputs":[{"localized_name":"clip视觉","name":"clip_vision","type":"CLIP_VISION","link":124},{"localized_name":"图像","name":"image","type":"IMAGE","link":142},{"localized_name":"裁剪","name":"crop","type":"COMBO","widget":{"name":"crop"},"link":null}],"outputs":[{"localized_name":"CLIP视觉输出","name":"CLIP_VISION_OUTPUT","type":"CLIP_VISION_OUTPUT","slot_index":0,"links":[127]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"CLIPVisionEncode"},"widgets_values":["center"]},{"id":72,"type":"StyleModelLoader","pos":[411.2784118652344,-276.7339172363281],"size":[340,60],"flags":{},"order":1,"mode":0,"inputs":[{"localized_name":"风格模型名称","name":"style_model_name","type":"COMBO","widget":{"name":"style_model_name"},"link":null}],"outputs":[{"localized_name":"风格模型","name":"STYLE_MODEL","type":"STYLE_MODEL","links":[126]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"StyleModelLoader"},"widgets_values":["flux1-redux-dev.safetensors"]},{"id":74,"type":"StyleModelApply","pos":[771.279296875,-396.73291015625],"size":[320,122],"flags":{},"order":20,"mode":0,"inputs":[{"localized_name":"条件","name":"conditioning","type":"CONDITIONING","link":128},{"localized_name":"风格模型","name":"style_model","type":"STYLE_MODEL","link":126},{"localized_name":"clip视觉输出","name":"clip_vision_output","type":"CLIP_VISION_OUTPUT","link":127},{"localized_name":"强度","name":"strength","type":"FLOAT","widget":{"name":"strength"},"link":null},{"localized_name":"强度类型","name":"strength_type","type":"COMBO","widget":{"name":"strength_type"},"link":null}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","slot_index":0,"links":[129]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"StyleModelApply"},"widgets_values":[1,"multiply"]},{"id":26,"type":"FluxGuidance","pos":[593,44],"size":[317.4000244140625,58],"flags":{},"order":15,"mode":0,"inputs":[{"localized_name":"条件","name":"conditioning","type":"CONDITIONING","link":41},{"localized_name":"引导","name":"guidance","type":"FLOAT","widget":{"name":"guidance"},"link":null}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","slot_index":0,"links":[128]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"FluxGuidance"},"widgets_values":[30]},{"id":38,"type":"InpaintModelConditioning","pos":[952,78],"size":[302.4000244140625,138],"flags":{},"order":21,"mode":0,"inputs":[{"localized_name":"正面条件","name":"positive","type":"CONDITIONING","link":129},{"localized_name":"负面条件","name":"negative","type":"CONDITIONING","link":81},{"localized_name":"vae","name":"vae","type":"VAE","link":82},{"localized_name":"像素","name":"pixels","type":"IMAGE","link":153},{"localized_name":"遮罩","name":"mask","type":"MASK","link":154},{"localized_name":"噪波遮罩","name":"noise_mask","type":"BOOLEAN","widget":{"name":"noise_mask"},"link":null}],"outputs":[{"localized_name":"正面条件","name":"positive","type":"CONDITIONING","slot_index":0,"links":[77]},{"localized_name":"负面条件","name":"negative","type":"CONDITIONING","slot_index":1,"links":[78]},{"localized_name":"Latent","name":"latent","type":"LATENT","slot_index":2,"links":[88]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"InpaintModelConditioning"},"widgets_values":[false]},{"id":23,"type":"CLIPTextEncode","pos":[144,-7],"size":[422.84503173828125,164.31304931640625],"flags":{},"order":10,"mode":0,"inputs":[{"localized_name":"clip","name":"clip","type":"CLIP","link":62},{"localized_name":"文本","name":"text","type":"STRING","widget":{"name":"text"},"link":null}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","slot_index":0,"links":[41]}],"title":"CLIP Text Encode (Positive Prompt)","properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"CLIPTextEncode"},"widgets_values":[""],"color":"#232","bgcolor":"#353"},{"id":7,"type":"CLIPTextEncode","pos":[141.06871032714844,429.3861083984375],"size":[425.27801513671875,180.6060791015625],"flags":{"collapsed":true},"order":11,"mode":0,"inputs":[{"localized_name":"clip","name":"clip","type":"CLIP","link":63},{"localized_name":"文本","name":"text","type":"STRING","widget":{"name":"text"},"link":null}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","slot_index":0,"links":[81]}],"title":"CLIP Text Encode (Negative Prompt)","properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"CLIPTextEncode"},"widgets_values":[""],"color":"#322","bgcolor":"#533"},{"id":75,"type":"Note","pos":[218.37094116210938,206.0338592529297],"size":[290.93646240234375,88.99921417236328],"flags":{},"order":2,"mode":0,"inputs":[],"outputs":[],"properties":{},"widgets_values":["由于使用redux此处可不填"],"color":"#432","bgcolor":"#653"},{"id":34,"type":"DualCLIPLoader","pos":[-237,79],"size":[315,130],"flags":{},"order":3,"mode":0,"inputs":[{"localized_name":"CLIP名称1","name":"clip_name1","type":"COMBO","widget":{"name":"clip_name1"},"link":null},{"localized_name":"CLIP名称2","name":"clip_name2","type":"COMBO","widget":{"name":"clip_name2"},"link":null},{"localized_name":"类型","name":"type","type":"COMBO","widget":{"name":"type"},"link":null},{"localized_name":"设备","name":"device","shape":7,"type":"COMBO","widget":{"name":"device"},"link":null}],"outputs":[{"localized_name":"CLIP","name":"CLIP","type":"CLIP","links":[62,63]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"DualCLIPLoader"},"widgets_values":["clip_l.safetensors","t5xxl_fp16.safetensors","flux","default"]},{"id":83,"type":"ReduxProcess","pos":[-459.5316467285156,-323.32476806640625],"size":[378,46],"flags":{},"order":16,"mode":0,"inputs":[{"localized_name":"ref_image","name":"ref_image","type":"IMAGE","link":140},{"localized_name":"ref_mask","name":"ref_mask","type":"MASK","link":141}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[142]}],"properties":{"Node name for S&R":"ReduxProcess"},"widgets_values":[]},{"id":73,"type":"CLIPVisionLoader","pos":[69.07898712158203,-503.0654296875],"size":[370,60],"flags":{},"order":4,"mode":0,"inputs":[{"localized_name":"clip名称","name":"clip_name","type":"COMBO","widget":{"name":"clip_name"},"link":null}],"outputs":[{"localized_name":"CLIP视觉","name":"CLIP_VISION","type":"CLIP_VISION","slot_index":0,"links":[124]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"CLIPVisionLoader"},"widgets_values":["sigclip_vision_patch14_384.safetensors"]},{"id":82,"type":"MaskOption","pos":[-206.56280517578125,750.6734008789062],"size":[352.79998779296875,78],"flags":{},"order":13,"mode":0,"inputs":[{"localized_name":"sketch","name":"sketch","type":"MASK","link":135},{"localized_name":"upload","name":"upload","type":"MASK","link":136},{"localized_name":"option","name":"option","type":"COMBO","widget":{"name":"option"},"link":null}],"outputs":[{"localized_name":"遮罩","name":"MASK","type":"MASK","links":[141,143]}],"title":"Ref_mask_option","properties":{"Node name for S&R":"MaskOption"},"widgets_values":["upload"]},{"id":85,"type":"CropBack","pos":[1846.4765625,484.9985656738281],"size":[327.5999755859375,146],"flags":{},"order":24,"mode":0,"inputs":[{"localized_name":"raw_image","name":"raw_image","type":"IMAGE","link":165},{"localized_name":"H1","name":"H1","type":"H1","link":147},{"localized_name":"W1","name":"W1","type":"W1","link":148},{"localized_name":"H2","name":"H2","type":"H2","link":149},{"localized_name":"W2","name":"W2","type":"W2","link":150},{"localized_name":"old_tar_image","name":"old_tar_image","type":"old_tar_image","link":151},{"localized_name":"tar_box_yyxx_crop","name":"tar_box_yyxx_crop","type":"tar_box_yyxx_crop","link":152}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[156]}],"properties":{"Node name for S&R":"CropBack"},"widgets_values":[]},{"id":9,"type":"SaveImage","pos":[2219.46728515625,75.3333511352539],"size":[828.9535522460938,893.8475341796875],"flags":{},"order":25,"mode":0,"inputs":[{"localized_name":"图片","name":"images","type":"IMAGE","link":156},{"localized_name":"文件名前缀","name":"filename_prefix","type":"STRING","widget":{"name":"filename_prefix"},"link":null}],"outputs":[],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"SaveImage"},"widgets_values":["ComfyUI"]},{"id":76,"type":"LoraLoaderModelOnly","pos":[1520.7386474609375,-242.78897094726562],"size":[315,82],"flags":{},"order":12,"mode":0,"inputs":[{"localized_name":"模型","name":"model","type":"MODEL","link":133},{"localized_name":"LoRA名称","name":"lora_name","type":"COMBO","widget":{"name":"lora_name"},"link":null},{"localized_name":"模型强度","name":"strength_model","type":"FLOAT","widget":{"name":"strength_model"},"link":null}],"outputs":[{"localized_name":"模型","name":"MODEL","type":"MODEL","links":[134]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.27","Node name for S&R":"LoraLoaderModelOnly"},"widgets_values":["20250321-082022_steps5000_pytorch_lora_weights.safetensors",1]},{"id":86,"type":"PreviewImage","pos":[789.43994140625,1059.72900390625],"size":[588.32666015625,442.0199279785156],"flags":{},"order":19,"mode":0,"inputs":[{"localized_name":"图像","name":"images","type":"IMAGE","link":158}],"outputs":[],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":81,"type":"MaskOption","pos":[-198.27432250976562,1277.5740966796875],"size":[352.79998779296875,78],"flags":{},"order":14,"mode":0,"inputs":[{"localized_name":"sketch","name":"sketch","type":"MASK","link":138},{"localized_name":"upload","name":"upload","type":"MASK","link":139},{"localized_name":"option","name":"option","type":"COMBO","widget":{"name":"option"},"link":null}],"outputs":[{"localized_name":"遮罩","name":"MASK","type":"MASK","links":[144]}],"title":"Src_mask_option","properties":{"Node name for S&R":"MaskOption"},"widgets_values":["upload"]},{"id":84,"type":"FillProcess","pos":[268.15966796875,713.9813842773438],"size":[380.4000244140625,218],"flags":{},"order":17,"mode":0,"inputs":[{"localized_name":"source_image","name":"source_image","type":"IMAGE","link":146},{"localized_name":"ref_image","name":"ref_image","type":"IMAGE","link":145},{"localized_name":"source_mask","name":"source_mask","type":"MASK","link":144},{"localized_name":"ref_mask","name":"ref_mask","type":"MASK","link":143},{"localized_name":"iterations","name":"iterations","type":"INT","widget":{"name":"iterations"},"link":null}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[153]},{"localized_name":"遮罩","name":"MASK","type":"MASK","links":[154]},{"localized_name":"H1","name":"H1","type":"H1","links":[147]},{"localized_name":"W1","name":"W1","type":"W1","links":[148]},{"localized_name":"H2","name":"H2","type":"H2","links":[149]},{"localized_name":"W2","name":"W2","type":"W2","links":[150]},{"localized_name":"old_tar_image","name":"old_tar_image","type":"old_tar_image","links":[151]},{"localized_name":"tar_box_yyxx_crop","name":"tar_box_yyxx_crop","type":"tar_box_yyxx_crop","links":[152]},{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[158]}],"properties":{"Node name for S&R":"FillProcess"},"widgets_values":[2]},{"id":8,"type":"VAEDecode","pos":[1620,98],"size":[210,46],"flags":{},"order":23,"mode":0,"inputs":[{"localized_name":"Latent","name":"samples","type":"LATENT","link":7},{"localized_name":"vae","name":"vae","type":"VAE","link":60}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","slot_index":0,"links":[165]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"VAEDecode"},"widgets_values":[]},{"id":31,"type":"UNETLoader","pos":[1148.4638671875,-235.78736877441406],"size":[315,82],"flags":{},"order":5,"mode":0,"inputs":[{"localized_name":"UNet名称","name":"unet_name","type":"COMBO","widget":{"name":"unet_name"},"link":null},{"localized_name":"数据类型","name":"weight_dtype","type":"COMBO","widget":{"name":"weight_dtype"},"link":null}],"outputs":[{"localized_name":"模型","name":"MODEL","type":"MODEL","slot_index":0,"links":[133]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"UNETLoader"},"widgets_values":["flux1-fill-dev.safetensors","fp8_e4m3fn"]},{"id":78,"type":"LoadImage","pos":[-1078.9261474609375,628.24267578125],"size":[315,314],"flags":{},"order":6,"mode":0,"inputs":[{"localized_name":"图像","name":"image","type":"COMBO","widget":{"name":"image"},"link":null},{"localized_name":"选择文件上传","name":"upload","type":"IMAGEUPLOAD","widget":{"name":"upload"},"link":null}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[140,145]},{"localized_name":"遮罩","name":"MASK","type":"MASK","links":[135]}],"title":"Load_ref_image","properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"LoadImage"},"widgets_values":["5.png","image"]},{"id":80,"type":"LoadImageMask","pos":[-719.0171508789062,627.2947387695312],"size":[315,318],"flags":{},"order":7,"mode":0,"inputs":[{"localized_name":"图像","name":"image","type":"COMBO","widget":{"name":"image"},"link":null},{"localized_name":"通道","name":"channel","type":"COMBO","widget":{"name":"channel"},"link":null},{"localized_name":"选择文件上传","name":"upload","type":"IMAGEUPLOAD","widget":{"name":"upload"},"link":null}],"outputs":[{"localized_name":"遮罩","name":"MASK","type":"MASK","links":[136]}],"title":"Load_ref_mask","properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"LoadImageMask"},"widgets_values":["5 (1).png","red","image"]},{"id":79,"type":"LoadImage","pos":[-1089.28564453125,1206.080322265625],"size":[315,314],"flags":{},"order":8,"mode":0,"inputs":[{"localized_name":"图像","name":"image","type":"COMBO","widget":{"name":"image"},"link":null},{"localized_name":"选择文件上传","name":"upload","type":"IMAGEUPLOAD","widget":{"name":"upload"},"link":null}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[146]},{"localized_name":"遮罩","name":"MASK","type":"MASK","links":[138]}],"title":"Load_src_image","properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"LoadImage"},"widgets_values":["5 (2).png","image"]},{"id":77,"type":"LoadImageMask","pos":[-698.533935546875,1205.022705078125],"size":[315,318],"flags":{},"order":9,"mode":0,"inputs":[{"localized_name":"图像","name":"image","type":"COMBO","widget":{"name":"image"},"link":null},{"localized_name":"通道","name":"channel","type":"COMBO","widget":{"name":"channel"},"link":null},{"localized_name":"选择文件上传","name":"upload","type":"IMAGEUPLOAD","widget":{"name":"upload"},"link":null}],"outputs":[{"localized_name":"遮罩","name":"MASK","type":"MASK","links":[139]}],"title":"Load_src_mask","properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"LoadImageMask"},"widgets_values":["5 (3).png","red","image"]},{"id":3,"type":"KSampler","pos":[1280,100],"size":[315,262],"flags":{},"order":22,"mode":0,"inputs":[{"localized_name":"模型","name":"model","type":"MODEL","link":134},{"localized_name":"正面条件","name":"positive","type":"CONDITIONING","link":77},{"localized_name":"负面条件","name":"negative","type":"CONDITIONING","link":78},{"localized_name":"Latent图像","name":"latent_image","type":"LATENT","link":88},{"localized_name":"种子","name":"seed","type":"INT","widget":{"name":"seed"},"link":null},{"localized_name":"步数","name":"steps","type":"INT","widget":{"name":"steps"},"link":null},{"localized_name":"cfg","name":"cfg","type":"FLOAT","widget":{"name":"cfg"},"link":null},{"localized_name":"采样器名称","name":"sampler_name","type":"COMBO","widget":{"name":"sampler_name"},"link":null},{"localized_name":"调度器","name":"scheduler","type":"COMBO","widget":{"name":"scheduler"},"link":null},{"localized_name":"降噪","name":"denoise","type":"FLOAT","widget":{"name":"denoise"},"link":null}],"outputs":[{"localized_name":"Latent","name":"LATENT","type":"LATENT","slot_index":0,"links":[7]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"KSampler"},"widgets_values":[42,"fixed",50,1,"euler","normal",1]}],"links":[[7,3,0,8,0,"LATENT"],[41,23,0,26,0,"CONDITIONING"],[60,32,0,8,1,"VAE"],[62,34,0,23,0,"CLIP"],[63,34,0,7,0,"CLIP"],[77,38,0,3,1,"CONDITIONING"],[78,38,1,3,2,"CONDITIONING"],[81,7,0,38,1,"CONDITIONING"],[82,32,0,38,2,"VAE"],[88,38,2,3,3,"LATENT"],[124,73,0,70,0,"CLIP_VISION"],[126,72,0,74,1,"STYLE_MODEL"],[127,70,0,74,2,"CLIP_VISION_OUTPUT"],[128,26,0,74,0,"CONDITIONING"],[129,74,0,38,0,"CONDITIONING"],[133,31,0,76,0,"MODEL"],[134,76,0,3,0,"MODEL"],[135,78,1,82,0,"MASK"],[136,80,0,82,1,"MASK"],[138,79,1,81,0,"MASK"],[139,77,0,81,1,"MASK"],[140,78,0,83,0,"IMAGE"],[141,82,0,83,1,"MASK"],[142,83,0,70,1,"IMAGE"],[143,82,0,84,3,"MASK"],[144,81,0,84,2,"MASK"],[145,78,0,84,1,"IMAGE"],[146,79,0,84,0,"IMAGE"],[147,84,2,85,1,"H1"],[148,84,3,85,2,"W1"],[149,84,4,85,3,"H2"],[150,84,5,85,4,"W2"],[151,84,6,85,5,"old_tar_image"],[152,84,7,85,6,"tar_box_yyxx_crop"],[153,84,0,38,3,"IMAGE"],[154,84,1,38,4,"MASK"],[156,85,0,9,0,"IMAGE"],[158,84,8,86,0,"IMAGE"],[165,8,0,85,0,"IMAGE"]],"groups":[{"id":2,"title":"Redux Model","bounding":[61.2788200378418,-580.332275390625,1040,507.6000061035156],"color":"#3f789e","font_size":24,"flags":{}},{"id":3,"title":"Reference","bounding":[-1127.897216796875,493.8901062011719,775.4630126953125,524.798583984375],"color":"#3f789e","font_size":24,"flags":{}},{"id":4,"title":"Source","bounding":[-1127.7064208984375,1083.024169921875,783.5238647460938,517.1103515625],"color":"#3f789e","font_size":24,"flags":{}}],"config":{},"extra":{"ds":{"scale":1.1,"offset":[-659.8000787998996,66.39938187446121]},"frontendVersion":"1.17.11"},"version":0.4} \ No newline at end of file diff --git a/README.md b/README.md index fd697f3..51f1f57 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,16 @@ Please first install [ComfyUI](https://github.com/comfyanonymous/ComfyUI/tree/ma python main.py ``` +## 🚀 Usage Examples +Using this [workflow](workflows/InsertAnything.json), the source image and ref_image are cropped and scaled to a standard size of 768*768 to generate the image. +The effect is shown in the figure below. +![insert_anything](assets/insert_anything.png) + +The Insert Anything LoRA still performs well at larger resolutions. Therefore, to avoid image quality loss caused by processing images to 768*768, you can also use this [workflow](`workflows/InsertAnything_noscaling.json`) to only crop the image for generation. In this case, you can set the image resolution more freely. + +The effect is shown in the figure below. + +![insert_anything_noscaling](assets/insert_anything_noscaling.png) diff --git a/__init__.py b/__init__.py index 9e6d964..0455cb9 100644 --- a/__init__.py +++ b/__init__.py @@ -1,10 +1,13 @@ from .insert_anything_node import MaskOption, ReduxProcess, FillProcess, CropBack +from .no_scaling import FillProcessNoScaling, CropBackNoScaling NODE_CLASS_MAPPINGS = { "MaskOption": MaskOption, "ReduxProcess": ReduxProcess, "FillProcess": FillProcess, "CropBack": CropBack, + "FillProcessNoScaling": FillProcessNoScaling, + "CropBackNoScaling": CropBackNoScaling, } NODE_DISPLAY_NAME_MAPPINGS = { @@ -12,4 +15,6 @@ NODE_DISPLAY_NAME_MAPPINGS = { "ReduxProcess": "InsertAnything - Redux Process", "FillProcess": "InsertAnything - Fill Process", "CropBack": "InsertAnything - Crop Back", + "FillProcessNoScaling": "InsertAnything - Fill Process (No Scaling)", + "CropBackNoScaling": "InsertAnything - Crop Back (No Scaling)", } diff --git a/assets/insert_anything.png b/assets/insert_anything.png new file mode 100644 index 0000000..3f006c2 Binary files /dev/null and b/assets/insert_anything.png differ diff --git a/assets/insert_anything_noscaling.png b/assets/insert_anything_noscaling.png new file mode 100644 index 0000000..4572952 Binary files /dev/null and b/assets/insert_anything_noscaling.png differ diff --git a/insert_anything_node.py b/insert_anything_node.py index 4a9bb1e..f9893e9 100644 --- a/insert_anything_node.py +++ b/insert_anything_node.py @@ -315,7 +315,10 @@ class FillProcess: } } RETURN_TYPES = ( - "IMAGE", "MASK", "H1", "W1", "H2", "W2", "old_tar_image", "tar_box_yyxx_crop", "IMAGE", + "IMAGE", "MASK", "IMAGE", "BOX", "CROP_PARAMS", "IMAGE", # Adjusted + ) + RETURN_NAMES = ( # Adjusted + "image", "mask", "old_tar_image", "tar_box_yyxx_crop", "crop_params", "preview_image", ) FUNCTION = "FillProcess" @@ -418,13 +421,29 @@ class FillProcess: diptych_ref_tar_tensor = torch.from_numpy(diptych_ref_tar.copy()).unsqueeze(0).float() / 255.0 mask_diptych_tensor = torch.from_numpy(output_mask_diptych_np.copy()).unsqueeze(0).unsqueeze(1).float() / 255.0 # (B, C, H, W) so (1,1,H,W) - mask_diptych_tensor = torch.from_numpy(output_mask_diptych_np.copy()).unsqueeze(0).float() / 255.0 - + mask_diptych_tensor = torch.from_numpy(output_mask_diptych_np.copy()).unsqueeze(0).float() / 255.0 # This was duplicated, using the (1,1,H,W) version above this line. Correcting. + # The line above was: mask_diptych_tensor = torch.from_numpy(output_mask_diptych_np.copy()).unsqueeze(0).unsqueeze(1).float() / 255.0 + # The line below it was: mask_diptych_tensor = torch.from_numpy(output_mask_diptych_np.copy()).unsqueeze(0).float() / 255.0 + # The unsqueeze(1) is for channel, so (B, C, H, W) is (1,1,H,W) for a single channel mask. + # Let's ensure the correct one is used. The one with unsqueeze(1) is typical for masks. + # Re-evaluating: output_mask_diptych_np is (H,W). + # For ComfyUI MASK type, it's often (B, H, W) or (B, 1, H, W). + # If it's (B,H,W) then .unsqueeze(0).float() / 255.0 is fine. + # If it needs to be (B,1,H,W) then .unsqueeze(0).unsqueeze(1).float() / 255.0 is correct. + # The original code had both, the second one overwriting the first. + # Let's stick to the (B, H, W) convention for mask output unless (B,1,H,W) is strictly needed by other nodes. + # Given `mask_diptych_tensor = torch.from_numpy(output_mask_diptych_np.copy()).unsqueeze(0).float() / 255.0` was the last one, let's assume it's (B,H,W) + # However, the type hint for MASK in ComfyUI is often a 2D tensor (H,W) or (1,H,W) for batch 1. + # Let's assume the output MASK type should be (1, H, W) for consistency with typical ComfyUI mask tensors. + # output_mask_diptych_np is (H,W). So, .unsqueeze(0) makes it (1,H,W). This is fine. + old_tar_image_tensor = torch.from_numpy(old_tar_image_np.astype(np.float32) / 255.0).unsqueeze(0) + crop_params_tuple = (H1, W1, H2, W2) + # tar_box_yyxx_crop is already a tuple (y1,y2,x1,x2) show_diptych_ref_tar_tensor = torch.from_numpy(show_diptych_ref_tar.copy()).unsqueeze(0).float() / 255.0 - return (diptych_ref_tar_tensor, mask_diptych_tensor, H1, W1, H2, W2, old_tar_image_np, tar_box_yyxx_crop, show_diptych_ref_tar_tensor) + return (diptych_ref_tar_tensor, mask_diptych_tensor, old_tar_image_tensor, tar_box_yyxx_crop, crop_params_tuple, show_diptych_ref_tar_tensor) @@ -435,12 +454,9 @@ class CropBack: return { "required": { "raw_image": ("IMAGE",), - "H1": ("H1",), - "W1": ("W1",), - "H2": ("H2",), - "W2": ("W2",), - "old_tar_image": ("old_tar_image",), - "tar_box_yyxx_crop": ("tar_box_yyxx_crop",), + "old_tar_image": ("IMAGE",), # Changed from custom type to IMAGE + "tar_box_yyxx_crop": ("BOX",), # Assuming BOX is the type for the tuple + "crop_params": ("CROP_PARAMS",) # Assuming CROP_PARAMS for (H1,W1,H2,W2) } } @@ -450,25 +466,59 @@ class CropBack: def CropBack( self, raw_image, - H1, W1, H2, W2, - old_tar_image, - tar_box_yyxx_crop + old_tar_image, # This is now a tensor + tar_box_yyxx_crop, # This is a tuple (y1,y2,x1,x2) + crop_params # This is a tuple (H1,W1,H2,W2) ): + # Unpack crop_params + H1, W1, H2, W2 = crop_params - raw_image = np.array(raw_image)[0] - raw_image = (raw_image * 255).round().astype(np.uint8) - raw_image = Image.fromarray(raw_image) + # Convert old_tar_image tensor to numpy array for crop_back helper + old_tar_image_np = (old_tar_image[0].cpu().numpy() * 255).round().astype(np.uint8) - width, height = raw_image.size + raw_image_np = np.array(raw_image)[0] # raw_image is already a tensor + raw_image_np = (raw_image_np * 255).round().astype(np.uint8) + # Convert raw_image_np to PIL Image for cropping the right half + pil_raw_image = Image.fromarray(raw_image_np) + + width, height = pil_raw_image.size left = width // 2 right = width top = 0 bottom = height - edited_image = raw_image.crop((left, top, right, bottom)) + edited_image_pil = pil_raw_image.crop((left, top, right, bottom)) - edited_image = np.array(edited_image) - edited_image = crop_back(edited_image, old_tar_image, np.array([H1, W1, H2, W2]), np.array(tar_box_yyxx_crop)) + edited_image_np = np.array(edited_image_pil) + + # tar_box_yyxx_crop is already a tuple, convert to numpy array if crop_back expects it + # The crop_back helper function expects tar_image (old_tar_image_np) and tar_box_yyxx_crop as numpy arrays. + # extra_sizes is also expected as a numpy array. + edited_image_final_np = crop_back(edited_image_np, old_tar_image_np, + np.array([H1, W1, H2, W2]), + np.array(tar_box_yyxx_crop)) - edited_image = torch.from_numpy(edited_image).unsqueeze(0).float() / 255.0 + edited_image_tensor = torch.from_numpy(edited_image_final_np.astype(np.float32) / 255.0).unsqueeze(0) - return (edited_image,) + return (edited_image_tensor,) + raw_image = (raw_image * 255).round().astype(np.uint8) + raw_image = Image.fromarray(raw_image) + + # This block is now part of the new structure above. + # raw_image = np.array(raw_image)[0] + # raw_image = (raw_image * 255).round().astype(np.uint8) + # raw_image = Image.fromarray(raw_image) + + # width, height = raw_image.size + # left = width // 2 + # right = width + # top = 0 + # bottom = height + # edited_image = raw_image.crop((left, top, right, bottom)) + + # edited_image = np.array(edited_image) + # edited_image = crop_back(edited_image, old_tar_image, np.array([H1, W1, H2, W2]), np.array(tar_box_yyxx_crop)) + + # edited_image = torch.from_numpy(edited_image).unsqueeze(0).float() / 255.0 + + # return (edited_image,) + pass # Placeholder for the removed block, the logic is now in the new method body diff --git a/no_scaling.py b/no_scaling.py new file mode 100644 index 0000000..919b582 --- /dev/null +++ b/no_scaling.py @@ -0,0 +1,345 @@ +import torch +import numpy as np +import cv2 +from PIL import Image +import math + +# Helper functions (copied or adapted from insert_anything_node.py) +def standardize_and_binarize_mask(mask_input): + if isinstance(mask_input, torch.Tensor): + mask_np = mask_input.cpu().numpy() + elif isinstance(mask_input, np.ndarray): + mask_np = mask_input + else: + raise TypeError(f"Mask input type {type(mask_input)} not supported. Expected torch.Tensor or np.ndarray.") + + if mask_np.ndim == 3 and mask_np.shape[0] == 1: + mask_np = mask_np.squeeze(0) + elif mask_np.ndim == 4 and mask_np.shape[0] == 1 and mask_np.shape[1] == 1: + mask_np = mask_np.squeeze(0).squeeze(0) + + if mask_np.ndim == 3: + if mask_np.shape[-1] == 1: + mask_np = mask_np.squeeze(axis=-1) + elif mask_np.shape[0] == 1: + mask_np = mask_np.squeeze(0) + elif mask_np.shape[-1] > 1: + mask_np = mask_np[..., 0] + + if mask_np.ndim != 2: + raise ValueError(f"Mask has unexpected shape {mask_np.shape} after initial processing. Expected 2D mask (H,W). Original input shape was {mask_input.shape if hasattr(mask_input, 'shape') else 'unknown'}.") + + if mask_np.dtype == np.float32 or mask_np.dtype == np.float64: + if mask_np.min() >= 0.0 and mask_np.max() <= 1.0: + mask_np = (mask_np * 255).astype(np.uint8) + else: + mask_np = np.clip(mask_np, 0, 255).astype(np.uint8) + elif mask_np.dtype != np.uint8: + mask_np = np.clip(mask_np, 0, 255).astype(np.uint8) + + _, mask_np_binarized = cv2.threshold(mask_np, 128, 255, cv2.THRESH_BINARY) + return mask_np_binarized + +def get_bbox_from_mask(mask): + h,w = mask.shape[0],mask.shape[1] + if mask.sum() < 10: + return 0,h-1,0,w-1 + rows = np.any(mask,axis=1) + cols = np.any(mask,axis=0) + y1,y2 = np.where(rows)[0][[0,-1]] + x1,x2 = np.where(cols)[0][[0,-1]] + return (y1,y2,x1,x2) + +def expand_image_mask(image, mask, ratio=1.4): + h,w = image.shape[0], image.shape[1] + H,W = int(h * ratio), int(w * ratio) + h1 = int((H - h) // 2) + h2 = H - h - h1 + w1 = int((W -w) // 2) + w2 = W -w - w1 + + pad_param_image = ((h1,h2),(w1,w2),(0,0)) if image.ndim == 3 else ((h1,h2),(w1,w2)) + pad_param_mask = ((h1,h2),(w1,w2)) + + image_padded = np.pad(image, pad_param_image, 'constant', constant_values=255 if image.ndim == 3 else 0) + mask_padded = np.pad(mask, pad_param_mask, 'constant', constant_values=0) + return image_padded, mask_padded + +def pad_to_square(image, pad_value = 255, random_padding = False): + H,W = image.shape[0], image.shape[1] + if H == W: + return image + + padd = abs(H - W) + if random_padding: + padd_1 = int(np.random.randint(0,padd+1)) + else: + padd_1 = int(padd / 2) + padd_2 = padd - padd_1 + + if len(image.shape) == 2: + if H > W: + pad_param = ((0, 0), (padd_1, padd_2)) + else: + pad_param = ((padd_1, padd_2), (0, 0)) + elif len(image.shape) == 3: + if H > W: + pad_param = ((0, 0), (padd_1, padd_2), (0, 0)) + else: + pad_param = ((padd_1, padd_2), (0, 0), (0, 0)) + else: + raise ValueError("Image must be 2D or 3D.") + + image_padded = np.pad(image, pad_param, 'constant', constant_values=pad_value) + return image_padded + +def create_highlighted_mask(image_np, mask_np, alpha=0.5, gray_value=128): + if mask_np.max() <= 1.0 and mask_np.dtype != np.uint8: + mask_np_uint8 = (mask_np * 255).astype(np.uint8) + elif mask_np.dtype != np.uint8: + mask_np_uint8 = np.clip(mask_np,0,255).astype(np.uint8) + else: + mask_np_uint8 = mask_np + + if mask_np_uint8.max() > 1: + mask_bool = mask_np_uint8 > 128 + else: + mask_bool = mask_np_uint8 > 0.5 + + image_float = image_np.astype(np.float32) + gray_overlay = np.full_like(image_float, gray_value, dtype=np.float32) + result = image_float.copy() + + result[mask_bool] = (1 - alpha) * image_float[mask_bool] + alpha * gray_overlay[mask_bool] + return result.astype(np.uint8) + +def adjust_to_multiple_of_val(value, multiple): + if multiple <= 0: + return value + if value == 0: + return 0 + remainder = value % multiple + if remainder == 0: + return value + return value + (multiple - remainder) + +def calculate_adjusted_dimension_and_offset(start_coord, current_length, total_img_length, multiple): + if current_length == 0 or total_img_length == 0: + return start_coord, 0 + + target_length = adjust_to_multiple_of_val(current_length, multiple) + + if start_coord + target_length <= total_img_length: + return start_coord, target_length + + new_start_coord_for_target_length = total_img_length - target_length + if new_start_coord_for_target_length >= 0: + return new_start_coord_for_target_length, target_length + + max_fit_multiple = math.floor(total_img_length / float(multiple)) * multiple + + if max_fit_multiple > 0: + original_center = start_coord + current_length / 2.0 + new_center = max_fit_multiple / 2.0 + aligned_start_coord = round(original_center - new_center) + aligned_start_coord = max(0, aligned_start_coord) + aligned_start_coord = min(aligned_start_coord, total_img_length - max_fit_multiple) + return int(aligned_start_coord), int(max_fit_multiple) + else: + final_length = min(current_length, total_img_length - start_coord) + final_length = max(1 if current_length > 0 and total_img_length - start_coord > 0 else 0, final_length) + return start_coord, final_length + +class FillProcessNoScaling: + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "source_image": ("IMAGE", ), + "ref_image": ("IMAGE", ), + "source_mask": ("MASK", ), + "ref_mask": ("MASK", ), + "iterations": ("INT", {"default": 2, "min": 0, "max": 100}), + "expand_pixels": ("INT", {"default": 0, "min": 0, "max": 1024}), + } + } + RETURN_TYPES = ("IMAGE", "MASK", "IMAGE", "BOX", "IMAGE") + RETURN_NAMES = ("image", "mask", "old_tar_image", "tar_box_yyxx_crop", "preview_image") + FUNCTION = "process" + + def process(self, source_image, ref_image, source_mask, ref_mask, iterations, expand_pixels): + source_image_np = (source_image[0].cpu().numpy() * 255).astype(np.uint8) + source_mask_np = standardize_and_binarize_mask(source_mask) + ref_image_np = (ref_image[0].cpu().numpy() * 255).astype(np.uint8) + ref_mask_np = standardize_and_binarize_mask(ref_mask) + + img_h, img_w = source_image_np.shape[:2] + + if iterations > 0: + kernel = np.ones((7, 7), np.uint8) + dilated_source_mask_np = cv2.dilate(source_mask_np, kernel, iterations=iterations) + else: + dilated_source_mask_np = source_mask_np.copy() + + y1_exp, y2_exp, x1_exp, x2_exp = get_bbox_from_mask(dilated_source_mask_np) + + initial_x1 = max(0, x1_exp - expand_pixels) + initial_y1 = max(0, y1_exp - expand_pixels) + initial_x2 = min(img_w - 1, x2_exp + expand_pixels) + initial_y2 = min(img_h - 1, y2_exp + expand_pixels) + + if initial_x1 >= initial_x2 or initial_y1 >= initial_y2: + initial_x1, initial_y1, initial_x2, initial_y2 = x1_exp,y1_exp,x2_exp,y2_exp + if initial_x1 >= initial_x2 or initial_y1 >= initial_y2: + initial_x1, initial_y1, initial_x2, initial_y2 = 0, 0, img_w - 1, img_h - 1 + + initial_bbox_w = initial_x2 - initial_x1 + 1 + initial_bbox_h = initial_y2 - initial_y1 + 1 + + final_x1, final_bbox_w = calculate_adjusted_dimension_and_offset(initial_x1, initial_bbox_w, img_w, 8) + final_y1, final_bbox_h = calculate_adjusted_dimension_and_offset(initial_y1, initial_bbox_h, img_h, 8) + + if initial_bbox_w > 0 and final_bbox_w == 0 and (img_w - final_x1) > 0 : + final_bbox_w = min(initial_bbox_w, img_w - final_x1) + final_bbox_w = max(1, final_bbox_w) + if initial_bbox_h > 0 and final_bbox_h == 0 and (img_h - final_y1) > 0: + final_bbox_h = min(initial_bbox_h, img_h - final_y1) + final_bbox_h = max(1, final_bbox_h) + + if final_bbox_w <= 0 or final_bbox_h <= 0: + cropped_source_image = np.full((8,8,3), 255, dtype=np.uint8) + cropped_source_mask = np.zeros((8,8), dtype=np.uint8) + final_x1, final_y1, final_bbox_w, final_bbox_h = 0,0,8,8 + else: + cropped_source_image = source_image_np[final_y1 : final_y1 + final_bbox_h, final_x1 : final_x1 + final_bbox_w, :] + cropped_source_mask = dilated_source_mask_np[final_y1 : final_y1 + final_bbox_h, final_x1 : final_x1 + final_bbox_w] + + ref_box_yyxx = get_bbox_from_mask(ref_mask_np) + ref_mask_0_1 = ref_mask_np // 255 + ref_mask_3_0_1 = np.stack([ref_mask_0_1]*3, axis=-1) + masked_ref_image = ref_image_np * ref_mask_3_0_1 + np.ones_like(ref_image_np, dtype=np.uint8) * 255 * (1 - ref_mask_3_0_1) + + ry1, ry2, rx1, rx2 = ref_box_yyxx + if not(ry1 >= ry2 or rx1 >= rx2): + masked_ref_image_cropped = masked_ref_image[ry1:ry2+1, rx1:rx2+1, :] + ref_mask_cropped_for_expand = ref_mask_np[ry1:ry2+1, rx1:rx2+1] + else: + masked_ref_image_cropped = np.full((100,100,3), 255, dtype=np.uint8) + ref_mask_cropped_for_expand = np.zeros((100,100), dtype=np.uint8) + + expanded_ref_image, _ = expand_image_mask(masked_ref_image_cropped, ref_mask_cropped_for_expand, ratio=1.3) + processed_ref_image_square = pad_to_square(expanded_ref_image, pad_value=255) + + target_ref_h = final_bbox_h + orig_ref_h, orig_ref_w = processed_ref_image_square.shape[:2] + + if orig_ref_h == 0 or target_ref_h == 0: + scaled_ref_image = np.full((target_ref_h if target_ref_h > 0 else 8, 100 if target_ref_h > 0 else 8, 3), 255, dtype=np.uint8) + if target_ref_h == 0 and final_bbox_h > 0: target_ref_h = scaled_ref_image.shape[0] # Update if placeholder used + else: + scale_ratio = target_ref_h / orig_ref_h + target_ref_w = round(orig_ref_w * scale_ratio) + if target_ref_w <=0: target_ref_w = 1 + scaled_ref_image = cv2.resize(processed_ref_image_square, (target_ref_w, target_ref_h), interpolation=cv2.INTER_AREA) + + diptych_image = np.concatenate([scaled_ref_image, cropped_source_image], axis=1) + + mask_for_ref_part = np.zeros((target_ref_h, scaled_ref_image.shape[1]), dtype=np.uint8) + if cropped_source_mask.ndim != 2: cropped_source_mask = cropped_source_mask[:,:,0] + diptych_mask_np = np.concatenate([mask_for_ref_part, cropped_source_mask], axis=1) + + diptych_mask_3ch_for_preview = np.stack([diptych_mask_np]*3, axis=-1) + show_diptych_image_np = create_highlighted_mask(diptych_image, diptych_mask_3ch_for_preview) + + diptych_image_tensor = torch.from_numpy(diptych_image.astype(np.float32) / 255.0).unsqueeze(0) + diptych_mask_tensor = torch.from_numpy(diptych_mask_np.astype(np.float32) / 255.0).unsqueeze(0).unsqueeze(1) + original_source_image_tensor = source_image.clone() + show_diptych_image_tensor = torch.from_numpy(show_diptych_image_np.astype(np.float32) / 255.0).unsqueeze(0) + + tar_box_yyxx_crop_value = (final_y1, final_y1 + final_bbox_h - 1, final_x1, final_x1 + final_bbox_w - 1) + + return (diptych_image_tensor, diptych_mask_tensor, original_source_image_tensor, tar_box_yyxx_crop_value, show_diptych_image_tensor) + +class CropBackNoScaling: + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "raw_image": ("IMAGE",), + "old_tar_image": ("IMAGE",), + "tar_box_yyxx_crop": ("BOX",), + } + } + RETURN_TYPES = ("IMAGE",) + FUNCTION = "crop_back" + + def crop_back(self, raw_image, old_tar_image, tar_box_yyxx_crop): + processed_np = (raw_image[0].cpu().numpy() * 255).astype(np.uint8) + original_source_np = (old_tar_image[0].cpu().numpy() * 255).astype(np.uint8) + + # Unpack tar_box_yyxx_crop + # It was (y1, y2_inclusive, x1, x2_inclusive) from FillProcessNoScaling + # We need final_bbox_x, final_bbox_y, final_bbox_width, final_bbox_height + crop_y1, crop_y2, crop_x1, crop_x2 = tar_box_yyxx_crop + final_bbox_x = crop_x1 + final_bbox_y = crop_y1 + final_bbox_width = crop_x2 - crop_x1 + 1 + final_bbox_height = crop_y2 - crop_y1 + 1 + + processed_h, processed_w = processed_np.shape[:2] + crop_x_start_from_right = max(0, processed_w - final_bbox_width) + crop_y_start_from_right = 0 + + slice_h_from_processed = min(processed_h, final_bbox_height) + slice_w_from_processed = min(final_bbox_width, processed_w - crop_x_start_from_right) + + if slice_w_from_processed <= 0 or slice_h_from_processed <= 0: + return (old_tar_image,) + + generated_part_raw = processed_np[ + crop_y_start_from_right : crop_y_start_from_right + slice_h_from_processed, + crop_x_start_from_right : crop_x_start_from_right + slice_w_from_processed, + : + ] + + if generated_part_raw.shape[0] != final_bbox_height or generated_part_raw.shape[1] != final_bbox_width: + if final_bbox_width > 0 and final_bbox_height > 0 : # only resize if target is valid + generated_part_resized = cv2.resize(generated_part_raw, (final_bbox_width, final_bbox_height), interpolation=cv2.INTER_AREA) + else: # if target is 0, cannot resize to it, use raw (which might be empty) + generated_part_resized = generated_part_raw + else: + generated_part_resized = generated_part_raw + + output_image_np = original_source_np.copy() + + paste_y1 = final_bbox_y + paste_x1 = final_bbox_x + + actual_paste_y1 = max(0, paste_y1) + actual_paste_x1 = max(0, paste_x1) + actual_paste_y2 = min(output_image_np.shape[0], paste_y1 + final_bbox_height) + actual_paste_x2 = min(output_image_np.shape[1], paste_x1 + final_bbox_width) + + h_to_paste_in_original = actual_paste_y2 - actual_paste_y1 + w_to_paste_in_original = actual_paste_x2 - actual_paste_x1 + + if h_to_paste_in_original > 0 and w_to_paste_in_original > 0 and \ + generated_part_resized.shape[0] >= h_to_paste_in_original and \ + generated_part_resized.shape[1] >= w_to_paste_in_original: + + slice_from_generated_y = slice(0, h_to_paste_in_original) + slice_from_generated_x = slice(0, w_to_paste_in_original) + + target_paste_slice_y = slice(actual_paste_y1, actual_paste_y2) + target_paste_slice_x = slice(actual_paste_x1, actual_paste_x2) + + try: + output_image_np[target_paste_slice_y, target_paste_slice_x, :] = \ + generated_part_resized[slice_from_generated_y, slice_from_generated_x, :] + except IndexError: + return (old_tar_image,) + else: + pass # Skip paste if no valid area or source data too small + + output_image_tensor = torch.from_numpy(output_image_np.astype(np.float32) / 255.0).unsqueeze(0) + return (output_image_tensor,) diff --git a/workflows/InsertAnything.json b/workflows/InsertAnything.json new file mode 100644 index 0000000..d422f91 --- /dev/null +++ b/workflows/InsertAnything.json @@ -0,0 +1 @@ +{"id":"cdbd4dcf-52c9-4ccd-8636-622cc4b3c262","revision":0,"last_node_id":155,"last_link_id":420,"nodes":[{"id":70,"type":"CLIPVisionEncode","pos":[203.34573364257812,-339.14990234375],"size":[290,78],"flags":{},"order":16,"mode":0,"inputs":[{"localized_name":"clip视觉","name":"clip_vision","type":"CLIP_VISION","link":124},{"localized_name":"图像","name":"image","type":"IMAGE","link":142},{"localized_name":"裁剪","name":"crop","type":"COMBO","widget":{"name":"crop"},"link":null}],"outputs":[{"localized_name":"CLIP视觉输出","name":"CLIP_VISION_OUTPUT","type":"CLIP_VISION_OUTPUT","slot_index":0,"links":[127]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"CLIPVisionEncode"},"widgets_values":["center"]},{"id":72,"type":"StyleModelLoader","pos":[183.34567260742188,-219.15090942382812],"size":[340,60],"flags":{},"order":0,"mode":0,"inputs":[{"localized_name":"风格模型名称","name":"style_model_name","type":"COMBO","widget":{"name":"style_model_name"},"link":null}],"outputs":[{"localized_name":"风格模型","name":"STYLE_MODEL","type":"STYLE_MODEL","links":[126]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"StyleModelLoader"},"widgets_values":["flux1-redux-dev.safetensors"]},{"id":74,"type":"StyleModelApply","pos":[543.3465576171875,-339.14990234375],"size":[320,122],"flags":{},"order":18,"mode":0,"inputs":[{"localized_name":"条件","name":"conditioning","type":"CONDITIONING","link":128},{"localized_name":"风格模型","name":"style_model","type":"STYLE_MODEL","link":126},{"localized_name":"clip视觉输出","name":"clip_vision_output","type":"CLIP_VISION_OUTPUT","link":127},{"localized_name":"强度","name":"strength","type":"FLOAT","widget":{"name":"strength"},"link":null},{"localized_name":"强度类型","name":"strength_type","type":"COMBO","widget":{"name":"strength_type"},"link":null}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","slot_index":0,"links":[129]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"StyleModelApply"},"widgets_values":[1,"multiply"]},{"id":73,"type":"CLIPVisionLoader","pos":[-158.8538055419922,-445.482421875],"size":[370,60],"flags":{},"order":1,"mode":0,"inputs":[{"localized_name":"clip名称","name":"clip_name","type":"COMBO","widget":{"name":"clip_name"},"link":null}],"outputs":[{"localized_name":"CLIP视觉","name":"CLIP_VISION","type":"CLIP_VISION","slot_index":0,"links":[124]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"CLIPVisionLoader"},"widgets_values":["sigclip_vision_patch14_384.safetensors"]},{"id":147,"type":"CLIPTextEncode","pos":[44.36542510986328,465.902587890625],"size":[400,200],"flags":{},"order":11,"mode":0,"inputs":[{"localized_name":"clip","name":"clip","type":"CLIP","link":397},{"localized_name":"文本","name":"text","type":"STRING","widget":{"name":"text"},"link":null}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","links":[398,400]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"CLIPTextEncode"},"widgets_values":[""]},{"id":148,"type":"ConditioningZeroOut","pos":[534.2006225585938,546.5010986328125],"size":[140,26],"flags":{},"order":15,"mode":0,"inputs":[{"localized_name":"条件","name":"conditioning","type":"CONDITIONING","link":400}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","links":[401]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"ConditioningZeroOut"},"widgets_values":[]},{"id":26,"type":"FluxGuidance","pos":[470.4208984375,397.3144836425781],"size":[317.4000244140625,58],"flags":{},"order":14,"mode":0,"inputs":[{"localized_name":"条件","name":"conditioning","type":"CONDITIONING","link":398},{"localized_name":"引导","name":"guidance","type":"FLOAT","widget":{"name":"guidance"},"link":null}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","slot_index":0,"links":[128]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"FluxGuidance"},"widgets_values":[30]},{"id":83,"type":"ReduxProcess","pos":[-610.1604614257812,-326.71441650390625],"size":[378,46],"flags":{},"order":12,"mode":0,"inputs":[{"localized_name":"ref_image","name":"ref_image","type":"IMAGE","link":140},{"localized_name":"ref_mask","name":"ref_mask","type":"MASK","link":403}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[142]}],"properties":{"cnr_id":"insertanything-comfyui-official","ver":"60dc57b9054f102a532ae1b0e1d4f75cedb050b8","Node name for S&R":"ReduxProcess","aux_id":"mo230761/InsertAnything-ComfyUI-official"},"widgets_values":[]},{"id":38,"type":"InpaintModelConditioning","pos":[884.9601440429688,102.37812042236328],"size":[302.4000244140625,138],"flags":{},"order":19,"mode":0,"inputs":[{"localized_name":"正面条件","name":"positive","type":"CONDITIONING","link":129},{"localized_name":"负面条件","name":"negative","type":"CONDITIONING","link":401},{"localized_name":"vae","name":"vae","type":"VAE","link":82},{"localized_name":"像素","name":"pixels","type":"IMAGE","link":411},{"localized_name":"遮罩","name":"mask","type":"MASK","link":412},{"localized_name":"噪波遮罩","name":"noise_mask","type":"BOOLEAN","widget":{"name":"noise_mask"},"link":null}],"outputs":[{"localized_name":"正面条件","name":"positive","type":"CONDITIONING","slot_index":0,"links":[77]},{"localized_name":"负面条件","name":"negative","type":"CONDITIONING","slot_index":1,"links":[78]},{"localized_name":"Latent","name":"latent","type":"LATENT","slot_index":2,"links":[88]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"InpaintModelConditioning"},"widgets_values":[true]},{"id":3,"type":"KSampler","pos":[866.9269409179688,331.59173583984375],"size":[315,474],"flags":{},"order":20,"mode":0,"inputs":[{"localized_name":"模型","name":"model","type":"MODEL","link":420},{"localized_name":"正面条件","name":"positive","type":"CONDITIONING","link":77},{"localized_name":"负面条件","name":"negative","type":"CONDITIONING","link":78},{"localized_name":"Latent图像","name":"latent_image","type":"LATENT","link":88},{"localized_name":"种子","name":"seed","type":"INT","widget":{"name":"seed"},"link":null},{"localized_name":"步数","name":"steps","type":"INT","widget":{"name":"steps"},"link":null},{"localized_name":"cfg","name":"cfg","type":"FLOAT","widget":{"name":"cfg"},"link":null},{"localized_name":"采样器名称","name":"sampler_name","type":"COMBO","widget":{"name":"sampler_name"},"link":null},{"localized_name":"调度器","name":"scheduler","type":"COMBO","widget":{"name":"scheduler"},"link":null},{"localized_name":"降噪","name":"denoise","type":"FLOAT","widget":{"name":"denoise"},"link":null}],"outputs":[{"localized_name":"Latent","name":"LATENT","type":"LATENT","slot_index":0,"links":[7]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"KSampler"},"widgets_values":[94,"fixed",28,1,"euler","normal",1]},{"id":31,"type":"UNETLoader","pos":[-376.8841552734375,60.17074966430664],"size":[315,82],"flags":{},"order":2,"mode":0,"inputs":[{"localized_name":"UNet名称","name":"unet_name","type":"COMBO","widget":{"name":"unet_name"},"link":null},{"localized_name":"数据类型","name":"weight_dtype","type":"COMBO","widget":{"name":"weight_dtype"},"link":null}],"outputs":[{"localized_name":"模型","name":"MODEL","type":"MODEL","slot_index":0,"links":[133]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"UNETLoader"},"widgets_values":["flux1-fill-dev.safetensors","fp8_e4m3fn"]},{"id":146,"type":"DualCLIPLoader","pos":[-374.86724853515625,467.6431884765625],"size":[270,130],"flags":{},"order":3,"mode":0,"inputs":[{"localized_name":"CLIP名称1","name":"clip_name1","type":"COMBO","widget":{"name":"clip_name1"},"link":null},{"localized_name":"CLIP名称2","name":"clip_name2","type":"COMBO","widget":{"name":"clip_name2"},"link":null},{"localized_name":"类型","name":"type","type":"COMBO","widget":{"name":"type"},"link":null},{"localized_name":"设备","name":"device","shape":7,"type":"COMBO","widget":{"name":"device"},"link":null}],"outputs":[{"localized_name":"CLIP","name":"CLIP","type":"CLIP","links":[397]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"DualCLIPLoader"},"widgets_values":["sd3\\clip_l.safetensors","sd3\\t5xxl_fp8_e4m3fn.safetensors","flux","default"]},{"id":8,"type":"VAEDecode","pos":[1228.59716796875,347.1978454589844],"size":[210,46],"flags":{},"order":21,"mode":0,"inputs":[{"localized_name":"Latent","name":"samples","type":"LATENT","link":7},{"localized_name":"vae","name":"vae","type":"VAE","link":60}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","slot_index":0,"links":[410]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"VAEDecode"},"widgets_values":[]},{"id":149,"type":"PreviewImage","pos":[1239.536865234375,636.1636962890625],"size":[278.1424865722656,256.23748779296875],"flags":{},"order":23,"mode":0,"inputs":[{"localized_name":"图像","name":"images","type":"IMAGE","link":416}],"outputs":[],"properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":151,"type":"CropBack","pos":[1269.9195556640625,455.90435791015625],"size":[207.19589233398438,86],"flags":{},"order":22,"mode":0,"inputs":[{"localized_name":"raw_image","name":"raw_image","type":"IMAGE","link":410},{"localized_name":"old_tar_image","name":"old_tar_image","type":"IMAGE","link":413},{"localized_name":"tar_box_yyxx_crop","name":"tar_box_yyxx_crop","type":"BOX","link":414},{"localized_name":"crop_params","name":"crop_params","type":"CROP_PARAMS","link":415}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[416]}],"properties":{"cnr_id":"insertanything-comfyui-official","ver":"60dc57b9054f102a532ae1b0e1d4f75cedb050b8","Node name for S&R":"CropBack"},"widgets_values":[]},{"id":75,"type":"Note","pos":[122.28762817382812,334.1654357910156],"size":[290.93646240234375,88.99921417236328],"flags":{},"order":4,"mode":0,"inputs":[],"outputs":[],"properties":{},"widgets_values":["由于使用redux此处可不填\nSince Redux is used, this field can be left blank."],"color":"#432","bgcolor":"#653"},{"id":32,"type":"VAELoader","pos":[119.39537811279297,1067.0821533203125],"size":[315,58],"flags":{},"order":5,"mode":0,"inputs":[{"localized_name":"vae名称","name":"vae_name","type":"COMBO","widget":{"name":"vae_name"},"link":null}],"outputs":[{"localized_name":"VAE","name":"VAE","type":"VAE","slot_index":0,"links":[60,82]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"VAELoader"},"widgets_values":["flux-ae.sft"]},{"id":152,"type":"Note","pos":[145.9034423828125,938.148193359375],"size":[290.93646240234375,88.99921417236328],"flags":{},"order":6,"mode":0,"inputs":[],"outputs":[],"properties":{},"widgets_values":["iterations用于扩展遮罩范围\n\"iterations\" is used to expand the mask area. "],"color":"#432","bgcolor":"#653"},{"id":153,"type":"Note","pos":[-918.7791137695312,-166.1560516357422],"size":[290.93646240234375,88.99921417236328],"flags":{},"order":7,"mode":0,"inputs":[],"outputs":[],"properties":{},"widgets_values":["此工作流裁剪缩放原图为768*768,以符合insert anything LoRA训练尺寸\nThis workflow resizes and crops the original image to 768*768 pixels to comply with the training dimensions required for insert anything LoRA."],"color":"#432","bgcolor":"#653"},{"id":150,"type":"FillProcess","pos":[143.97174072265625,734.1602172851562],"size":[281.091796875,158],"flags":{},"order":13,"mode":0,"inputs":[{"localized_name":"source_image","name":"source_image","type":"IMAGE","link":418},{"localized_name":"ref_image","name":"ref_image","type":"IMAGE","link":406},{"localized_name":"source_mask","name":"source_mask","type":"MASK","link":419},{"localized_name":"ref_mask","name":"ref_mask","type":"MASK","link":408},{"localized_name":"iterations","name":"iterations","type":"INT","widget":{"name":"iterations"},"link":null}],"outputs":[{"localized_name":"image","name":"image","type":"IMAGE","links":[411]},{"localized_name":"mask","name":"mask","type":"MASK","links":[412]},{"localized_name":"old_tar_image","name":"old_tar_image","type":"IMAGE","links":[413]},{"localized_name":"tar_box_yyxx_crop","name":"tar_box_yyxx_crop","type":"BOX","links":[414]},{"localized_name":"crop_params","name":"crop_params","type":"CROP_PARAMS","links":[415]},{"localized_name":"preview_image","name":"preview_image","type":"IMAGE","links":[417]}],"properties":{"cnr_id":"insertanything-comfyui-official","ver":"60dc57b9054f102a532ae1b0e1d4f75cedb050b8","Node name for S&R":"FillProcess"},"widgets_values":[2]},{"id":78,"type":"LoadImage","pos":[-836.4896850585938,195.5147705078125],"size":[315,314],"flags":{},"order":8,"mode":0,"inputs":[{"localized_name":"图像","name":"image","type":"COMBO","widget":{"name":"image"},"link":null},{"localized_name":"选择文件上传","name":"upload","type":"IMAGEUPLOAD","widget":{"name":"upload"},"link":null}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[140,406]},{"localized_name":"遮罩","name":"MASK","type":"MASK","links":[403,408]}],"title":"Load_ref_image","properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"LoadImage"},"widgets_values":["clipspace/clipspace-mask-5898574.6000000015.png [input]","image"]},{"id":154,"type":"PreviewImage","pos":[511.4064636230469,843.2265014648438],"size":[428.6097412109375,415.2807312011719],"flags":{},"order":17,"mode":0,"inputs":[{"localized_name":"图像","name":"images","type":"IMAGE","link":417}],"outputs":[],"properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":155,"type":"LoadImage","pos":[-820.7493286132812,719.1520385742188],"size":[315,314.00006103515625],"flags":{},"order":9,"mode":0,"inputs":[{"localized_name":"图像","name":"image","type":"COMBO","widget":{"name":"image"},"link":null},{"localized_name":"选择文件上传","name":"upload","type":"IMAGEUPLOAD","widget":{"name":"upload"},"link":null}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[418]},{"localized_name":"遮罩","name":"MASK","type":"MASK","links":[419]}],"title":"Load_src_image","properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"LoadImage"},"widgets_values":["clipspace/clipspace-mask-134377.59999999776.png [input]","image"]},{"id":76,"type":"LoraLoaderModelOnly","pos":[-20.996715545654297,53.16912841796875],"size":[315,82],"flags":{},"order":10,"mode":0,"inputs":[{"localized_name":"模型","name":"model","type":"MODEL","link":133},{"localized_name":"LoRA名称","name":"lora_name","type":"COMBO","widget":{"name":"lora_name"},"link":null},{"localized_name":"模型强度","name":"strength_model","type":"FLOAT","widget":{"name":"strength_model"},"link":null}],"outputs":[{"localized_name":"模型","name":"MODEL","type":"MODEL","links":[420]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.27","Node name for S&R":"LoraLoaderModelOnly"},"widgets_values":["flux\\insert-anything-lora.safetensors",1]}],"links":[[7,3,0,8,0,"LATENT"],[60,32,0,8,1,"VAE"],[77,38,0,3,1,"CONDITIONING"],[78,38,1,3,2,"CONDITIONING"],[82,32,0,38,2,"VAE"],[88,38,2,3,3,"LATENT"],[124,73,0,70,0,"CLIP_VISION"],[126,72,0,74,1,"STYLE_MODEL"],[127,70,0,74,2,"CLIP_VISION_OUTPUT"],[128,26,0,74,0,"CONDITIONING"],[129,74,0,38,0,"CONDITIONING"],[133,31,0,76,0,"MODEL"],[140,78,0,83,0,"IMAGE"],[142,83,0,70,1,"IMAGE"],[397,146,0,147,0,"CLIP"],[398,147,0,26,0,"CONDITIONING"],[400,147,0,148,0,"CONDITIONING"],[401,148,0,38,1,"CONDITIONING"],[403,78,1,83,1,"MASK"],[406,78,0,150,1,"IMAGE"],[408,78,1,150,3,"MASK"],[410,8,0,151,0,"IMAGE"],[411,150,0,38,3,"IMAGE"],[412,150,1,38,4,"MASK"],[413,150,2,151,1,"IMAGE"],[414,150,3,151,2,"BOX"],[415,150,4,151,3,"CROP_PARAMS"],[416,151,0,149,0,"IMAGE"],[417,150,5,154,0,"IMAGE"],[418,155,0,150,0,"IMAGE"],[419,155,1,150,2,"MASK"],[420,76,0,3,0,"MODEL"]],"groups":[{"id":2,"title":"Redux Model","bounding":[-166.65396118164062,-522.749267578125,1040,507.6000061035156],"color":"#3f789e","font_size":24,"flags":{}},{"id":3,"title":"Reference","bounding":[-885.4607543945312,61.16197204589844,407.48931884765625,481.5951843261719],"color":"#3f789e","font_size":24,"flags":{}},{"id":4,"title":"Source","bounding":[-871.143798828125,616.7518920898438,417.5911560058594,466.6368713378906],"color":"#3f789e","font_size":24,"flags":{}}],"config":{},"extra":{"ds":{"scale":1.0152559799477383,"offset":[838.6874912153148,171.31621481925686]},"frontendVersion":"1.17.11"},"version":0.4} \ No newline at end of file diff --git a/workflows/InsertAnything_noscaling.json b/workflows/InsertAnything_noscaling.json new file mode 100644 index 0000000..3475fe4 --- /dev/null +++ b/workflows/InsertAnything_noscaling.json @@ -0,0 +1 @@ +{"id":"6903bc84-03e8-4556-b26d-f85a12238671","revision":0,"last_node_id":156,"last_link_id":412,"nodes":[{"id":70,"type":"CLIPVisionEncode","pos":[203.34573364257812,-339.14990234375],"size":[290,78],"flags":{},"order":17,"mode":0,"inputs":[{"localized_name":"clip视觉","name":"clip_vision","type":"CLIP_VISION","link":124},{"localized_name":"图像","name":"image","type":"IMAGE","link":142},{"localized_name":"裁剪","name":"crop","type":"COMBO","widget":{"name":"crop"},"link":null}],"outputs":[{"localized_name":"CLIP视觉输出","name":"CLIP_VISION_OUTPUT","type":"CLIP_VISION_OUTPUT","slot_index":0,"links":[127]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"CLIPVisionEncode"},"widgets_values":["center"]},{"id":72,"type":"StyleModelLoader","pos":[183.34567260742188,-219.15090942382812],"size":[340,60],"flags":{},"order":0,"mode":0,"inputs":[{"localized_name":"风格模型名称","name":"style_model_name","type":"COMBO","widget":{"name":"style_model_name"},"link":null}],"outputs":[{"localized_name":"风格模型","name":"STYLE_MODEL","type":"STYLE_MODEL","links":[126]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"StyleModelLoader"},"widgets_values":["flux1-redux-dev.safetensors"]},{"id":74,"type":"StyleModelApply","pos":[543.3465576171875,-339.14990234375],"size":[320,122],"flags":{},"order":19,"mode":0,"inputs":[{"localized_name":"条件","name":"conditioning","type":"CONDITIONING","link":128},{"localized_name":"风格模型","name":"style_model","type":"STYLE_MODEL","link":126},{"localized_name":"clip视觉输出","name":"clip_vision_output","type":"CLIP_VISION_OUTPUT","link":127},{"localized_name":"强度","name":"strength","type":"FLOAT","widget":{"name":"strength"},"link":null},{"localized_name":"强度类型","name":"strength_type","type":"COMBO","widget":{"name":"strength_type"},"link":null}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","slot_index":0,"links":[129]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"StyleModelApply"},"widgets_values":[1,"multiply"]},{"id":73,"type":"CLIPVisionLoader","pos":[-158.8538055419922,-445.482421875],"size":[370,60],"flags":{},"order":1,"mode":0,"inputs":[{"localized_name":"clip名称","name":"clip_name","type":"COMBO","widget":{"name":"clip_name"},"link":null}],"outputs":[{"localized_name":"CLIP视觉","name":"CLIP_VISION","type":"CLIP_VISION","slot_index":0,"links":[124]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"CLIPVisionLoader"},"widgets_values":["sigclip_vision_patch14_384.safetensors"]},{"id":147,"type":"CLIPTextEncode","pos":[44.36542510986328,465.902587890625],"size":[400,200],"flags":{},"order":11,"mode":0,"inputs":[{"localized_name":"clip","name":"clip","type":"CLIP","link":397},{"localized_name":"文本","name":"text","type":"STRING","widget":{"name":"text"},"link":null}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","links":[398,400]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"CLIPTextEncode"},"widgets_values":[""]},{"id":148,"type":"ConditioningZeroOut","pos":[534.2006225585938,546.5010986328125],"size":[140,26],"flags":{},"order":16,"mode":0,"inputs":[{"localized_name":"条件","name":"conditioning","type":"CONDITIONING","link":400}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","links":[401]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"ConditioningZeroOut"},"widgets_values":[]},{"id":83,"type":"ReduxProcess","pos":[-610.1604614257812,-326.71441650390625],"size":[378,46],"flags":{},"order":13,"mode":0,"inputs":[{"localized_name":"ref_image","name":"ref_image","type":"IMAGE","link":140},{"localized_name":"ref_mask","name":"ref_mask","type":"MASK","link":403}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[142]}],"properties":{"cnr_id":"insertanything-comfyui-official","ver":"60dc57b9054f102a532ae1b0e1d4f75cedb050b8","Node name for S&R":"ReduxProcess","aux_id":"mo230761/InsertAnything-ComfyUI-official"},"widgets_values":[]},{"id":38,"type":"InpaintModelConditioning","pos":[884.9601440429688,102.37812042236328],"size":[302.4000244140625,138],"flags":{},"order":20,"mode":0,"inputs":[{"localized_name":"正面条件","name":"positive","type":"CONDITIONING","link":129},{"localized_name":"负面条件","name":"negative","type":"CONDITIONING","link":401},{"localized_name":"vae","name":"vae","type":"VAE","link":82},{"localized_name":"像素","name":"pixels","type":"IMAGE","link":391},{"localized_name":"遮罩","name":"mask","type":"MASK","link":392},{"localized_name":"噪波遮罩","name":"noise_mask","type":"BOOLEAN","widget":{"name":"noise_mask"},"link":null}],"outputs":[{"localized_name":"正面条件","name":"positive","type":"CONDITIONING","slot_index":0,"links":[77]},{"localized_name":"负面条件","name":"negative","type":"CONDITIONING","slot_index":1,"links":[78]},{"localized_name":"Latent","name":"latent","type":"LATENT","slot_index":2,"links":[88]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"InpaintModelConditioning"},"widgets_values":[true]},{"id":8,"type":"VAEDecode","pos":[1228.59716796875,347.1978454589844],"size":[210,46],"flags":{},"order":22,"mode":0,"inputs":[{"localized_name":"Latent","name":"samples","type":"LATENT","link":7},{"localized_name":"vae","name":"vae","type":"VAE","link":60}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","slot_index":0,"links":[366]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"VAEDecode"},"widgets_values":[]},{"id":140,"type":"CropBackNoScaling","pos":[1227.3760986328125,475.4908752441406],"size":[288.1128845214844,66],"flags":{},"order":23,"mode":0,"inputs":[{"localized_name":"raw_image","name":"raw_image","type":"IMAGE","link":366},{"localized_name":"old_tar_image","name":"old_tar_image","type":"IMAGE","link":365},{"localized_name":"tar_box_yyxx_crop","name":"tar_box_yyxx_crop","type":"BOX","link":367}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[404]}],"properties":{"cnr_id":"insertanything-comfyui-official","ver":"60dc57b9054f102a532ae1b0e1d4f75cedb050b8","Node name for S&R":"CropBackNoScaling"},"widgets_values":[]},{"id":146,"type":"DualCLIPLoader","pos":[-374.86724853515625,467.6431884765625],"size":[270,130],"flags":{},"order":2,"mode":0,"inputs":[{"localized_name":"CLIP名称1","name":"clip_name1","type":"COMBO","widget":{"name":"clip_name1"},"link":null},{"localized_name":"CLIP名称2","name":"clip_name2","type":"COMBO","widget":{"name":"clip_name2"},"link":null},{"localized_name":"类型","name":"type","type":"COMBO","widget":{"name":"type"},"link":null},{"localized_name":"设备","name":"device","shape":7,"type":"COMBO","widget":{"name":"device"},"link":null}],"outputs":[{"localized_name":"CLIP","name":"CLIP","type":"CLIP","links":[397]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"DualCLIPLoader"},"widgets_values":["sd3\\clip_l.safetensors","sd3\\t5xxl_fp8_e4m3fn.safetensors","flux","default"]},{"id":31,"type":"UNETLoader","pos":[-376.8841552734375,60.17074966430664],"size":[315,82],"flags":{},"order":3,"mode":0,"inputs":[{"localized_name":"UNet名称","name":"unet_name","type":"COMBO","widget":{"name":"unet_name"},"link":null},{"localized_name":"数据类型","name":"weight_dtype","type":"COMBO","widget":{"name":"weight_dtype"},"link":null}],"outputs":[{"localized_name":"模型","name":"MODEL","type":"MODEL","slot_index":0,"links":[133]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"UNETLoader"},"widgets_values":["flux\\flux1-fill-dev_fp8.safetensors","fp8_e4m3fn"]},{"id":32,"type":"VAELoader","pos":[100.43464660644531,1122.609375],"size":[315,58],"flags":{},"order":4,"mode":0,"inputs":[{"localized_name":"vae名称","name":"vae_name","type":"COMBO","widget":{"name":"vae_name"},"link":null}],"outputs":[{"localized_name":"VAE","name":"VAE","type":"VAE","slot_index":0,"links":[60,82]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"VAELoader"},"widgets_values":["flux-ae.sft"]},{"id":150,"type":"Note","pos":[135.41366577148438,955.3892211914062],"size":[290.93646240234375,88.99921417236328],"flags":{},"order":5,"mode":0,"inputs":[],"outputs":[],"properties":{},"widgets_values":["iterations用于扩展遮罩范围\n\"iterations\" is used to expand the mask area. \nexpand_pixels用于扩展裁剪范围\n\"expand_pixels\" is used to expand the crop area."],"color":"#432","bgcolor":"#653"},{"id":78,"type":"LoadImage","pos":[-836.4896850585938,195.5147705078125],"size":[315,314],"flags":{},"order":6,"mode":0,"inputs":[{"localized_name":"图像","name":"image","type":"COMBO","widget":{"name":"image"},"link":null},{"localized_name":"选择文件上传","name":"upload","type":"IMAGEUPLOAD","widget":{"name":"upload"},"link":null}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[140,360]},{"localized_name":"遮罩","name":"MASK","type":"MASK","links":[402,403]}],"title":"Load_ref_image","properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"LoadImage"},"widgets_values":["clipspace/clipspace-mask-4807760.300000001.png [input]","image"]},{"id":26,"type":"FluxGuidance","pos":[470.4208984375,397.3144836425781],"size":[317.4000244140625,58],"flags":{},"order":15,"mode":0,"inputs":[{"localized_name":"条件","name":"conditioning","type":"CONDITIONING","link":398},{"localized_name":"引导","name":"guidance","type":"FLOAT","widget":{"name":"guidance"},"link":null}],"outputs":[{"localized_name":"条件","name":"CONDITIONING","type":"CONDITIONING","slot_index":0,"links":[128]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"FluxGuidance"},"widgets_values":[30]},{"id":149,"type":"PreviewImage","pos":[1239.5367431640625,594.3023071289062],"size":[278.1424865722656,256.23748779296875],"flags":{},"order":24,"mode":0,"inputs":[{"localized_name":"图像","name":"images","type":"IMAGE","link":404}],"outputs":[],"properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":75,"type":"Note","pos":[122.28762817382812,334.1654357910156],"size":[290.93646240234375,88.99921417236328],"flags":{},"order":7,"mode":0,"inputs":[],"outputs":[],"properties":{},"widgets_values":["由于使用redux此处可不填\nSince Redux is used, this field can be left blank."],"color":"#432","bgcolor":"#653"},{"id":153,"type":"Note","pos":[103.853515625,331.9549560546875],"size":[290.93646240234375,88.99921417236328],"flags":{},"order":8,"mode":0,"inputs":[],"outputs":[],"properties":{},"widgets_values":["由于使用redux此处可不填\nSince Redux is used, this field can be left blank."],"color":"#432","bgcolor":"#653"},{"id":154,"type":"Note","pos":[-939.93212890625,-130.3990020751953],"size":[290.93646240234375,88.99921417236328],"flags":{},"order":9,"mode":0,"inputs":[],"outputs":[],"properties":{},"widgets_values":["裁剪原图遮罩附近区域进行重绘,避免缩放导致图片质量下降\nThis workflow crops the original image around the masked area for redrawing, avoiding a decrease in picture quality that can result from scaling."],"color":"#432","bgcolor":"#653"},{"id":138,"type":"FillProcessNoScaling","pos":[80.09119415283203,737.4682006835938],"size":[355.0992126464844,162],"flags":{},"order":14,"mode":0,"inputs":[{"localized_name":"source_image","name":"source_image","type":"IMAGE","link":410},{"localized_name":"ref_image","name":"ref_image","type":"IMAGE","link":360},{"localized_name":"source_mask","name":"source_mask","type":"MASK","link":411},{"localized_name":"ref_mask","name":"ref_mask","type":"MASK","link":402},{"localized_name":"iterations","name":"iterations","type":"INT","widget":{"name":"iterations"},"link":null},{"localized_name":"expand_pixels","name":"expand_pixels","type":"INT","widget":{"name":"expand_pixels"},"link":null}],"outputs":[{"localized_name":"image","name":"image","type":"IMAGE","links":[391]},{"localized_name":"mask","name":"mask","type":"MASK","links":[392]},{"localized_name":"old_tar_image","name":"old_tar_image","type":"IMAGE","links":[365]},{"localized_name":"tar_box_yyxx_crop","name":"tar_box_yyxx_crop","type":"BOX","links":[367]},{"localized_name":"preview_image","name":"preview_image","type":"IMAGE","links":[409]}],"properties":{"cnr_id":"insertanything-comfyui-official","ver":"60dc57b9054f102a532ae1b0e1d4f75cedb050b8","Node name for S&R":"FillProcessNoScaling"},"widgets_values":[0,64]},{"id":3,"type":"KSampler","pos":[866.9269409179688,331.59173583984375],"size":[315,474],"flags":{},"order":21,"mode":0,"inputs":[{"localized_name":"模型","name":"model","type":"MODEL","link":412},{"localized_name":"正面条件","name":"positive","type":"CONDITIONING","link":77},{"localized_name":"负面条件","name":"negative","type":"CONDITIONING","link":78},{"localized_name":"Latent图像","name":"latent_image","type":"LATENT","link":88},{"localized_name":"种子","name":"seed","type":"INT","widget":{"name":"seed"},"link":null},{"localized_name":"步数","name":"steps","type":"INT","widget":{"name":"steps"},"link":null},{"localized_name":"cfg","name":"cfg","type":"FLOAT","widget":{"name":"cfg"},"link":null},{"localized_name":"采样器名称","name":"sampler_name","type":"COMBO","widget":{"name":"sampler_name"},"link":null},{"localized_name":"调度器","name":"scheduler","type":"COMBO","widget":{"name":"scheduler"},"link":null},{"localized_name":"降噪","name":"denoise","type":"FLOAT","widget":{"name":"denoise"},"link":null}],"outputs":[{"localized_name":"Latent","name":"LATENT","type":"LATENT","slot_index":0,"links":[7]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.30","Node name for S&R":"KSampler"},"widgets_values":[42,"fixed",28,1,"euler","normal",1]},{"id":156,"type":"LoadImage","pos":[-811.22900390625,726.3577880859375],"size":[315,314.00006103515625],"flags":{},"order":10,"mode":0,"inputs":[{"localized_name":"图像","name":"image","type":"COMBO","widget":{"name":"image"},"link":null},{"localized_name":"选择文件上传","name":"upload","type":"IMAGEUPLOAD","widget":{"name":"upload"},"link":null}],"outputs":[{"localized_name":"图像","name":"IMAGE","type":"IMAGE","links":[410]},{"localized_name":"遮罩","name":"MASK","type":"MASK","links":[411]}],"title":"Load_src_image","properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"LoadImage"},"widgets_values":["clipspace/clipspace-mask-134377.59999999776.png [input]","image"]},{"id":155,"type":"PreviewImage","pos":[541.0213623046875,857.2556762695312],"size":[340.0912780761719,337.933837890625],"flags":{},"order":18,"mode":0,"inputs":[{"localized_name":"图像","name":"images","type":"IMAGE","link":409}],"outputs":[],"properties":{"cnr_id":"comfy-core","ver":"0.3.39","Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":76,"type":"LoraLoaderModelOnly","pos":[-20.996715545654297,53.16912841796875],"size":[315,82],"flags":{},"order":12,"mode":0,"inputs":[{"localized_name":"模型","name":"model","type":"MODEL","link":133},{"localized_name":"LoRA名称","name":"lora_name","type":"COMBO","widget":{"name":"lora_name"},"link":null},{"localized_name":"模型强度","name":"strength_model","type":"FLOAT","widget":{"name":"strength_model"},"link":null}],"outputs":[{"localized_name":"模型","name":"MODEL","type":"MODEL","links":[412]}],"properties":{"cnr_id":"comfy-core","ver":"0.3.27","Node name for S&R":"LoraLoaderModelOnly"},"widgets_values":["flux\\insert-anything-lora.safetensors",1]}],"links":[[7,3,0,8,0,"LATENT"],[60,32,0,8,1,"VAE"],[77,38,0,3,1,"CONDITIONING"],[78,38,1,3,2,"CONDITIONING"],[82,32,0,38,2,"VAE"],[88,38,2,3,3,"LATENT"],[124,73,0,70,0,"CLIP_VISION"],[126,72,0,74,1,"STYLE_MODEL"],[127,70,0,74,2,"CLIP_VISION_OUTPUT"],[128,26,0,74,0,"CONDITIONING"],[129,74,0,38,0,"CONDITIONING"],[133,31,0,76,0,"MODEL"],[140,78,0,83,0,"IMAGE"],[142,83,0,70,1,"IMAGE"],[360,78,0,138,1,"IMAGE"],[365,138,2,140,1,"IMAGE"],[366,8,0,140,0,"IMAGE"],[367,138,3,140,2,"BOX"],[391,138,0,38,3,"IMAGE"],[392,138,1,38,4,"MASK"],[397,146,0,147,0,"CLIP"],[398,147,0,26,0,"CONDITIONING"],[400,147,0,148,0,"CONDITIONING"],[401,148,0,38,1,"CONDITIONING"],[402,78,1,138,3,"MASK"],[403,78,1,83,1,"MASK"],[404,140,0,149,0,"IMAGE"],[409,138,4,155,0,"IMAGE"],[410,156,0,138,0,"IMAGE"],[411,156,1,138,2,"MASK"],[412,76,0,3,0,"MODEL"]],"groups":[{"id":2,"title":"Redux Model","bounding":[-166.65396118164062,-522.749267578125,1040,507.6000061035156],"color":"#3f789e","font_size":24,"flags":{}},{"id":3,"title":"Reference","bounding":[-885.4607543945312,61.16197204589844,407.48931884765625,481.5951843261719],"color":"#3f789e","font_size":24,"flags":{}},{"id":4,"title":"Source","bounding":[-871.143798828125,616.7518920898438,417.5911560058594,466.6368713378906],"color":"#3f789e","font_size":24,"flags":{}}],"config":{},"extra":{"ds":{"scale":0.8390545288824335,"offset":[1063.9374113773715,8.038649924378284]},"frontendVersion":"1.17.11"},"version":0.4} \ No newline at end of file