From 28dbca823da3aa3c797d4e609f5a81e53897b906 Mon Sep 17 00:00:00 2001 From: Raykosan <71210053+Raykosan@users.noreply.github.com> Date: Sat, 22 Aug 2026 22:40:13 +0300 Subject: [PATCH] Added nodes for working with upscalers: RS Upscale & Resize, RS Tile Adjustments, RS Tile Assembly --- Example/RS Upscaler SeedVR2.json | 1 + Rayko_Tile_Adjustments.py | 137 +++++++++++++++++++++++++ Rayko_Tile_Assemble.py | 169 +++++++++++++++++++++++++++++++ Rayko_Upscale_Resize.py | 160 +++++++++++++++++++++++++++++ Rayko_Upscaler.py | 20 +++- __init__.py | 2 +- package.json | 7 +- pyproject.toml | 2 +- web/rs_upscaler.js | 7 +- 9 files changed, 497 insertions(+), 8 deletions(-) create mode 100644 Example/RS Upscaler SeedVR2.json create mode 100644 Rayko_Tile_Adjustments.py create mode 100644 Rayko_Tile_Assemble.py create mode 100644 Rayko_Upscale_Resize.py diff --git a/Example/RS Upscaler SeedVR2.json b/Example/RS Upscaler SeedVR2.json new file mode 100644 index 0000000..e14572a --- /dev/null +++ b/Example/RS Upscaler SeedVR2.json @@ -0,0 +1 @@ +{"id":"30a9537e-c03c-490f-a677-2423285376a0","revision":0,"last_node_id":245,"last_link_id":494,"nodes":[{"id":235,"type":"SaveImage","pos":[290,-260],"size":[360,340],"flags":{},"order":3,"mode":0,"inputs":[{"localized_name":"images","name":"images","type":"IMAGE","link":485},{"localized_name":"filename_prefix","name":"filename_prefix","type":"STRING","widget":{"name":"filename_prefix"},"link":null}],"outputs":[{"localized_name":"images","name":"images","type":"IMAGE","links":null}],"properties":{"cnr_id":"comfy-core","ver":"0.33.0","Node name for S&R":"SaveImage","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.8"}},"widgets_values":["ComfyUI"],"widgets_values_named":{"filename_prefix":"ComfyUI"}},{"id":230,"type":"RaykoSplineMask","pos":[-210,-550],"size":[470,630],"flags":{},"order":0,"mode":0,"inputs":[{"localized_name":"image","name":"image","type":"STRING","widget":{"name":"image"},"link":null},{"localized_name":"coordinates","name":"coordinates","shape":7,"type":"STRING","widget":{"name":"coordinates"},"link":null}],"outputs":[{"localized_name":"image","name":"image","type":"IMAGE","links":[464,484]},{"localized_name":"mask","name":"mask","type":"MASK","links":null}],"properties":{"cnr_id":"ComfyUI_RaykoStudio","ver":"dcdd7276833c5f1546f6177794ce1232781fb1dd","Node name for S&R":"RaykoSplineMask","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.8"}},"widgets_values":["prompt_00044.png","[]"],"widgets_values_named":{"image":"prompt_00044.png","coordinates":"[]"}},{"id":232,"type":"Note","pos":[350,-640],"size":[240,90],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[],"title":"Width & Height factor tiles","properties":{"ue_properties":{"version":"7.5.2","widget_ue_connectable":{},"input_ue_unconnectable":{}}},"widgets_values":["4-4 for square\n3-4 for portrait\n4-3 for landscape"],"widgets_values_named":{"text":"4-4 for square\n3-4 for portrait\n4-3 for landscape"},"color":"#432","bgcolor":"#653"},{"id":234,"type":"RSComparer","pos":[680,-550],"size":[470,630],"flags":{},"order":4,"mode":0,"inputs":[{"localized_name":"image_1","name":"image_1","shape":7,"type":"IMAGE","link":464},{"localized_name":"image_2","name":"image_2","shape":7,"type":"IMAGE","link":486},{"localized_name":"zoom","name":"zoom","type":"FLOAT","widget":{"name":"zoom"},"link":null},{"localized_name":"pan_x","name":"pan_x","type":"INT","widget":{"name":"pan_x"},"link":null},{"localized_name":"pan_y","name":"pan_y","type":"INT","widget":{"name":"pan_y"},"link":null}],"outputs":[{"localized_name":"images","name":"images","type":"IMAGE","links":null}],"properties":{"cnr_id":"ComfyUI_RaykoStudio","ver":"dcdd7276833c5f1546f6177794ce1232781fb1dd","Node name for S&R":"RSComparer","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.8"}},"widgets_values":[7.1,0,17],"widgets_values_named":{"zoom":7.1,"pan_x":0,"pan_y":17}},{"id":245,"type":"3dbd8046-129b-4c64-8134-a51b510f21ab","pos":[290,-480],"size":[360,160],"flags":{},"order":2,"mode":0,"inputs":[{"label":"model DIT","name":"model_1","type":"COMBO","widget":{"name":"model_1"},"link":null},{"label":"model VAE","name":"model","type":"COMBO","widget":{"name":"model"},"link":null},{"label":"scale","name":"scale_by","type":"FLOAT","widget":{"name":"scale_by"},"link":null},{"label":"width factor tile","name":"width_factor_tile","type":"INT","widget":{"name":"width_factor_tile"},"link":null},{"label":"height factor tile","name":"height_factor_tile","type":"INT","widget":{"name":"height_factor_tile"},"link":null},{"localized_name":"image","name":"image","type":"IMAGE","link":484}],"outputs":[{"localized_name":"FINAL_IMAGE","name":"FINAL_IMAGE","type":"IMAGE","links":[485,486]}],"properties":{"cnr_id":"comfy-core","ver":"0.33.0","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.8"},"previewExposures":[]},"widgets_values":["seedvr2_ema_3b_fp16.safetensors","ema_vae_fp16.safetensors",3,3,4],"widgets_values_named":{"model_1":"seedvr2_ema_3b_fp16.safetensors","model":"ema_vae_fp16.safetensors","scale_by":3,"width_factor_tile":3,"height_factor_tile":4}}],"links":[[464,230,0,234,0,"IMAGE"],[484,230,0,245,5,"IMAGE"],[485,245,0,235,0,"IMAGE"],[486,245,0,234,1,"IMAGE"]],"groups":[],"definitions":{"subgraphs":[{"id":"3dbd8046-129b-4c64-8134-a51b510f21ab","version":1,"state":{"lastGroupId":0,"lastNodeId":245,"lastLinkId":494,"lastRerouteId":0},"revision":0,"config":{},"name":"RS Upscaler SeedVR2","inputNode":{"id":-10,"bounding":[-70,-220,144.43333435058594,168]},"outputNode":{"id":-20,"bounding":[2320,-214,128,68]},"inputs":[{"id":"1fe85cc6-3d74-4b63-9da8-41acc0255f79","name":"model_1","type":"COMBO","linkIds":[489],"label":"dit model","pos":[50.43333435058594,-196]},{"id":"d8b56726-0fbc-46c7-b96e-e90c27bd4b29","name":"model","type":"COMBO","linkIds":[488],"label":"vae model","pos":[50.43333435058594,-176]},{"id":"17dacf65-5ecb-4c85-8f9b-933a1031a5a3","name":"scale_by","type":"FLOAT","linkIds":[492],"pos":[50.43333435058594,-156]},{"id":"058d2ced-7099-4365-b5f8-9b1169ce3453","name":"width_factor_tile","type":"INT","linkIds":[493],"pos":[50.43333435058594,-136]},{"id":"2181263a-bf7a-4f0d-88c5-e2cce13740da","name":"height_factor_tile","type":"INT","linkIds":[494],"pos":[50.43333435058594,-116]},{"id":"e893b487-2878-4a19-9f46-389c4961d48d","name":"image","type":"IMAGE","linkIds":[481],"localized_name":"image","pos":[50.43333435058594,-96]}],"outputs":[{"id":"b8f6cd59-a0f2-47ed-8df5-f5a98f099eda","name":"FINAL_IMAGE","type":"IMAGE","linkIds":[476,476],"localized_name":"FINAL_IMAGE","pos":[2344,-190]}],"widgets":[],"nodes":[{"id":236,"type":"SeedVR2VideoUpscaler","pos":[1260,-330],"size":[380,390],"flags":{},"order":0,"mode":0,"inputs":[{"label":"image","localized_name":"image","name":"image","type":"IMAGE","link":483},{"label":"dit","localized_name":"dit","name":"dit","type":"SEEDVR2_DIT","link":467},{"label":"vae","localized_name":"vae","name":"vae","type":"SEEDVR2_VAE","link":468},{"label":"seed","localized_name":"seed","name":"seed","type":"INT","widget":{"name":"seed"},"link":null},{"label":"resolution","localized_name":"resolution","name":"resolution","type":"INT","widget":{"name":"resolution"},"link":null},{"label":"max_resolution","localized_name":"max_resolution","name":"max_resolution","type":"INT","widget":{"name":"max_resolution"},"link":null},{"label":"batch_size","localized_name":"batch_size","name":"batch_size","type":"INT","widget":{"name":"batch_size"},"link":null},{"label":"uniform_batch_size","localized_name":"uniform_batch_size","name":"uniform_batch_size","type":"BOOLEAN","widget":{"name":"uniform_batch_size"},"link":null},{"label":"color_correction","localized_name":"color_correction","name":"color_correction","type":"COMBO","widget":{"name":"color_correction"},"link":null},{"label":"temporal_overlap","localized_name":"temporal_overlap","name":"temporal_overlap","shape":7,"type":"INT","widget":{"name":"temporal_overlap"},"link":null},{"label":"prepend_frames","localized_name":"prepend_frames","name":"prepend_frames","shape":7,"type":"INT","widget":{"name":"prepend_frames"},"link":null},{"label":"input_noise_scale","localized_name":"input_noise_scale","name":"input_noise_scale","shape":7,"type":"FLOAT","widget":{"name":"input_noise_scale"},"link":null},{"label":"latent_noise_scale","localized_name":"latent_noise_scale","name":"latent_noise_scale","shape":7,"type":"FLOAT","widget":{"name":"latent_noise_scale"},"link":null},{"label":"offload_device","localized_name":"offload_device","name":"offload_device","shape":7,"type":"COMBO","widget":{"name":"offload_device"},"link":null},{"label":"enable_debug","localized_name":"enable_debug","name":"enable_debug","shape":7,"type":"BOOLEAN","widget":{"name":"enable_debug"},"link":null}],"outputs":[{"label":"image","localized_name":"IMAGE","name":"IMAGE","type":"IMAGE","links":[470]}],"properties":{"cnr_id":"seedvr2_videoupscaler","ver":"2.5.10","Node name for S&R":"SeedVR2VideoUpscaler","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.4.1"},"enableTabs":false,"tabWidth":65,"tabXOffset":10,"hasSecondTab":false,"secondTabText":"Send Back","secondTabOffset":80,"secondTabWidth":65,"widget_ue_connectable":{}},"widgets_values":[2794489657,"fixed",1024,0,1,false,"wavelet",0,0,0,0,"cpu",false],"widgets_values_named":{"seed":2794489657,"control_after_generate":"fixed","resolution":1024,"max_resolution":0,"batch_size":1,"uniform_batch_size":false,"color_correction":"wavelet","temporal_overlap":0,"prepend_frames":0,"input_noise_scale":0,"latent_noise_scale":0,"offload_device":"cpu","enable_debug":false},"color":"#2a363b","bgcolor":"#3f5159"},{"id":240,"type":"SeedVR2LoadVAEModel","pos":[880,-130],"size":[340,300],"flags":{},"order":4,"mode":0,"inputs":[{"label":"torch_compile_args","localized_name":"torch_compile_args","name":"torch_compile_args","shape":7,"type":"TORCH_COMPILE_ARGS","link":null},{"label":"vae model","localized_name":"model","name":"model","type":"COMBO","widget":{"name":"model"},"link":488},{"label":"device","localized_name":"device","name":"device","type":"COMBO","widget":{"name":"device"},"link":null},{"label":"encode_tiled","localized_name":"encode_tiled","name":"encode_tiled","shape":7,"type":"BOOLEAN","widget":{"name":"encode_tiled"},"link":null},{"label":"encode_tile_size","localized_name":"encode_tile_size","name":"encode_tile_size","shape":7,"type":"INT","widget":{"name":"encode_tile_size"},"link":null},{"label":"encode_tile_overlap","localized_name":"encode_tile_overlap","name":"encode_tile_overlap","shape":7,"type":"INT","widget":{"name":"encode_tile_overlap"},"link":null},{"label":"decode_tiled","localized_name":"decode_tiled","name":"decode_tiled","shape":7,"type":"BOOLEAN","widget":{"name":"decode_tiled"},"link":null},{"label":"decode_tile_size","localized_name":"decode_tile_size","name":"decode_tile_size","shape":7,"type":"INT","widget":{"name":"decode_tile_size"},"link":null},{"label":"decode_tile_overlap","localized_name":"decode_tile_overlap","name":"decode_tile_overlap","shape":7,"type":"INT","widget":{"name":"decode_tile_overlap"},"link":null},{"label":"tile_debug","localized_name":"tile_debug","name":"tile_debug","shape":7,"type":"COMBO","widget":{"name":"tile_debug"},"link":null},{"label":"offload_device","localized_name":"offload_device","name":"offload_device","shape":7,"type":"COMBO","widget":{"name":"offload_device"},"link":null},{"label":"cache_model","localized_name":"cache_model","name":"cache_model","shape":7,"type":"BOOLEAN","widget":{"name":"cache_model"},"link":null}],"outputs":[{"label":"vae","localized_name":"SEEDVR2_VAE","name":"SEEDVR2_VAE","type":"SEEDVR2_VAE","links":[468]}],"properties":{"cnr_id":"seedvr2_videoupscaler","ver":"2.5.10","Node name for S&R":"SeedVR2LoadVAEModel","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.4.1"},"enableTabs":false,"tabWidth":65,"tabXOffset":10,"hasSecondTab":false,"secondTabText":"Send Back","secondTabOffset":80,"secondTabWidth":65,"widget_ue_connectable":{}},"widgets_values":["ema_vae_fp16.safetensors","cuda:0",false,256,32,false,256,32,"false","none",false],"widgets_values_named":{"model":"ema_vae_fp16.safetensors","device":"cuda:0","encode_tiled":false,"encode_tile_size":256,"encode_tile_overlap":32,"decode_tiled":false,"decode_tile_size":256,"decode_tile_overlap":32,"tile_debug":"false","offload_device":"none","cache_model":false},"color":"#2a363b","bgcolor":"#3f5159"},{"id":244,"type":"RSUpscaler","pos":[900,-330],"size":[300,130],"flags":{},"order":7,"mode":0,"inputs":[{"localized_name":"image","name":"image","type":"IMAGE","link":482},{"localized_name":"upscale_model","name":"upscale_model","type":"COMBO","widget":{"name":"upscale_model"},"link":null},{"localized_name":"upscale_method","name":"upscale_method","type":"COMBO","widget":{"name":"upscale_method"},"link":null},{"localized_name":"upscale_x","name":"upscale_x","type":"FLOAT","widget":{"name":"upscale_x"},"link":null}],"outputs":[{"localized_name":"IMAGE","name":"IMAGE","type":"IMAGE","links":[483]}],"properties":{"cnr_id":"ComfyUI_RaykoStudio","ver":"dcdd7276833c5f1546f6177794ce1232781fb1dd","Node name for S&R":"RSUpscaler","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.8"}},"widgets_values":["","nearest-exact",2,""],"widgets_values_named":{"upscale_model":"","upscale_method":"nearest-exact","upscale_x":2,"rs_custom_widgets":""}},{"id":239,"type":"RSTileImage","pos":[580,-490],"size":[270,210],"flags":{},"order":3,"mode":0,"inputs":[{"localized_name":"image","name":"image","type":"IMAGE","link":471},{"localized_name":"width_factor_tile","name":"width_factor_tile","type":"INT","widget":{"name":"width_factor_tile"},"link":493},{"localized_name":"height_factor_tile","name":"height_factor_tile","type":"INT","widget":{"name":"height_factor_tile"},"link":494},{"localized_name":"overlap_rate","name":"overlap_rate","type":"FLOAT","widget":{"name":"overlap_rate"},"link":null}],"outputs":[{"localized_name":"IMAGES","name":"IMAGES","type":"IMAGE","links":[482]},{"localized_name":"POSITIONS","name":"POSITIONS","type":"LIST","links":[478]},{"localized_name":"ORIGINAL_SIZE","name":"ORIGINAL_SIZE","type":"TUPLE","links":[479]},{"localized_name":"GRID_SIZE","name":"GRID_SIZE","type":"TUPLE","links":[480]},{"localized_name":"tile_width","name":"tile_width","type":"INT","links":[472]},{"localized_name":"tile_height","name":"tile_height","type":"INT","links":[473]}],"properties":{"cnr_id":"ComfyUI_RaykoStudio","ver":"dcdd7276833c5f1546f6177794ce1232781fb1dd","Node name for S&R":"RSTileImage","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.8"}},"widgets_values":[3,4,0.1],"widgets_values_named":{"width_factor_tile":3,"height_factor_tile":4,"overlap_rate":0.1}},{"id":242,"type":"SeedVR2LoadDiTModel","pos":[510,-190],"size":[340,210],"flags":{},"order":5,"mode":0,"inputs":[{"label":"torch_compile_args","localized_name":"torch_compile_args","name":"torch_compile_args","shape":7,"type":"TORCH_COMPILE_ARGS","link":null},{"label":"dit model","localized_name":"model","name":"model","type":"COMBO","widget":{"name":"model"},"link":489},{"label":"device","localized_name":"device","name":"device","type":"COMBO","widget":{"name":"device"},"link":null},{"label":"blocks_to_swap","localized_name":"blocks_to_swap","name":"blocks_to_swap","shape":7,"type":"INT","widget":{"name":"blocks_to_swap"},"link":null},{"label":"swap_io_components","localized_name":"swap_io_components","name":"swap_io_components","shape":7,"type":"BOOLEAN","widget":{"name":"swap_io_components"},"link":null},{"label":"offload_device","localized_name":"offload_device","name":"offload_device","shape":7,"type":"COMBO","widget":{"name":"offload_device"},"link":null},{"label":"cache_model","localized_name":"cache_model","name":"cache_model","shape":7,"type":"BOOLEAN","widget":{"name":"cache_model"},"link":null},{"label":"attention_mode","localized_name":"attention_mode","name":"attention_mode","shape":7,"type":"COMBO","widget":{"name":"attention_mode"},"link":null}],"outputs":[{"label":"dit","localized_name":"SEEDVR2_DIT","name":"SEEDVR2_DIT","type":"SEEDVR2_DIT","links":[467]}],"properties":{"cnr_id":"seedvr2_videoupscaler","ver":"2.5.10","Node name for S&R":"SeedVR2LoadDiTModel","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.4.1"},"enableTabs":false,"tabWidth":65,"tabXOffset":10,"hasSecondTab":false,"secondTabText":"Send Back","secondTabOffset":80,"secondTabWidth":65,"widget_ue_connectable":{}},"widgets_values":["seedvr2_ema_3b_fp16.safetensors","cuda:0",36,false,"cpu","sdpa","sdpa"],"widgets_values_named":{"model":"seedvr2_ema_3b_fp16.safetensors","device":"cuda:0","blocks_to_swap":36,"swap_io_components":false,"offload_device":"cpu","cache_model":"sdpa","attention_mode":"sdpa"},"color":"#2a363b","bgcolor":"#3f5159"},{"id":238,"type":"RSTileAssemble","pos":[1990,-500],"size":[270,120],"flags":{},"order":2,"mode":0,"inputs":[{"localized_name":"tiles","name":"tiles","type":"IMAGE","link":475},{"localized_name":"positions","name":"positions","type":"LIST","link":478},{"localized_name":"original_size","name":"original_size","type":"TUPLE","link":479},{"localized_name":"grid_size","name":"grid_size","type":"TUPLE","link":480},{"localized_name":"feather_size","name":"feather_size","type":"INT","widget":{"name":"feather_size"},"link":null}],"outputs":[{"localized_name":"FINAL_IMAGE","name":"FINAL_IMAGE","type":"IMAGE","links":[476]}],"properties":{"cnr_id":"ComfyUI_RaykoStudio","ver":"dcdd7276833c5f1546f6177794ce1232781fb1dd","Node name for S&R":"RSTileAssemble","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.8"}},"widgets_values":[64],"widgets_values_named":{"feather_size":64}},{"id":237,"type":"RSUpscaleResize","pos":[1680,-330],"size":[270,250],"flags":{},"order":1,"mode":0,"inputs":[{"localized_name":"image","name":"image","type":"IMAGE","link":470},{"localized_name":"width","name":"width","type":"INT","widget":{"name":"width"},"link":472},{"localized_name":"height","name":"height","type":"INT","widget":{"name":"height"},"link":473},{"localized_name":"upscale_method","name":"upscale_method","type":"COMBO","widget":{"name":"upscale_method"},"link":null},{"localized_name":"scale_by","name":"scale_by","type":"FLOAT","widget":{"name":"scale_by"},"link":null},{"localized_name":"method","name":"method","type":"COMBO","widget":{"name":"method"},"link":null},{"localized_name":"condition","name":"condition","type":"COMBO","widget":{"name":"condition"},"link":null},{"localized_name":"multiple_of","name":"multiple_of","type":"COMBO","widget":{"name":"multiple_of"},"link":null}],"outputs":[{"localized_name":"IMAGE","name":"IMAGE","type":"IMAGE","links":[475]},{"localized_name":"width","name":"width","type":"INT","links":[]},{"localized_name":"height","name":"height","type":"INT","links":[]}],"title":"🦊 RS Upscale & Resize Tile","properties":{"cnr_id":"ComfyUI_RaykoStudio","ver":"dcdd7276833c5f1546f6177794ce1232781fb1dd","Node name for S&R":"RSUpscaleResize","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.8"}},"widgets_values":[0,0,"lanczos",2,"stretch","always",8],"widgets_values_named":{"width":0,"height":0,"upscale_method":"lanczos","scale_by":2,"method":"stretch","condition":"always","multiple_of":8}},{"id":243,"type":"RSUpscaleResize","pos":[170,-490],"size":[270,250],"flags":{},"order":6,"mode":0,"inputs":[{"localized_name":"image","name":"image","type":"IMAGE","link":481},{"localized_name":"width","name":"width","type":"INT","widget":{"name":"width"},"link":null},{"localized_name":"height","name":"height","type":"INT","widget":{"name":"height"},"link":null},{"localized_name":"upscale_method","name":"upscale_method","type":"COMBO","widget":{"name":"upscale_method"},"link":null},{"localized_name":"scale_by","name":"scale_by","type":"FLOAT","widget":{"name":"scale_by"},"link":492},{"localized_name":"method","name":"method","type":"COMBO","widget":{"name":"method"},"link":null},{"localized_name":"condition","name":"condition","type":"COMBO","widget":{"name":"condition"},"link":null},{"localized_name":"multiple_of","name":"multiple_of","type":"COMBO","widget":{"name":"multiple_of"},"link":null}],"outputs":[{"localized_name":"IMAGE","name":"IMAGE","type":"IMAGE","links":[471]},{"localized_name":"width","name":"width","type":"INT","links":[]},{"localized_name":"height","name":"height","type":"INT","links":[]}],"properties":{"cnr_id":"ComfyUI_RaykoStudio","ver":"dcdd7276833c5f1546f6177794ce1232781fb1dd","Node name for S&R":"RSUpscaleResize","ue_properties":{"widget_ue_connectable":{},"input_ue_unconnectable":{},"version":"7.8"}},"widgets_values":[0,0,"lanczos",2,"stretch","always",8],"widgets_values_named":{"width":0,"height":0,"upscale_method":"lanczos","scale_by":2,"method":"stretch","condition":"always","multiple_of":8}}],"groups":[],"links":[{"id":483,"origin_id":244,"origin_slot":0,"target_id":236,"target_slot":0,"type":"IMAGE"},{"id":467,"origin_id":242,"origin_slot":0,"target_id":236,"target_slot":1,"type":"SEEDVR2_DIT"},{"id":468,"origin_id":240,"origin_slot":0,"target_id":236,"target_slot":2,"type":"SEEDVR2_VAE"},{"id":470,"origin_id":236,"origin_slot":0,"target_id":237,"target_slot":0,"type":"IMAGE"},{"id":472,"origin_id":239,"origin_slot":4,"target_id":237,"target_slot":1,"type":"INT"},{"id":473,"origin_id":239,"origin_slot":5,"target_id":237,"target_slot":2,"type":"INT"},{"id":482,"origin_id":239,"origin_slot":0,"target_id":244,"target_slot":0,"type":"IMAGE"},{"id":471,"origin_id":243,"origin_slot":0,"target_id":239,"target_slot":0,"type":"IMAGE"},{"id":475,"origin_id":237,"origin_slot":0,"target_id":238,"target_slot":0,"type":"IMAGE"},{"id":478,"origin_id":239,"origin_slot":1,"target_id":238,"target_slot":1,"type":"LIST"},{"id":479,"origin_id":239,"origin_slot":2,"target_id":238,"target_slot":2,"type":"TUPLE"},{"id":480,"origin_id":239,"origin_slot":3,"target_id":238,"target_slot":3,"type":"TUPLE"},{"id":481,"origin_id":-10,"origin_slot":5,"target_id":243,"target_slot":0,"type":"IMAGE"},{"id":476,"origin_id":238,"origin_slot":0,"target_id":-20,"target_slot":0,"type":"IMAGE"},{"id":488,"origin_id":-10,"origin_slot":1,"target_id":240,"target_slot":1,"type":"COMBO"},{"id":489,"origin_id":-10,"origin_slot":0,"target_id":242,"target_slot":1,"type":"COMBO"},{"id":492,"origin_id":-10,"origin_slot":2,"target_id":243,"target_slot":4,"type":"FLOAT"},{"id":493,"origin_id":-10,"origin_slot":3,"target_id":239,"target_slot":1,"type":"INT"},{"id":494,"origin_id":-10,"origin_slot":4,"target_id":239,"target_slot":2,"type":"INT"}],"extra":{"ue_links":[],"links_added_by_ue":[]}}]},"config":{},"extra":{"ue_links":[],"links_added_by_ue":[]},"version":0.4} \ No newline at end of file diff --git a/Rayko_Tile_Adjustments.py b/Rayko_Tile_Adjustments.py new file mode 100644 index 0000000..6505689 --- /dev/null +++ b/Rayko_Tile_Adjustments.py @@ -0,0 +1,137 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2025-2026 Raykosan (RaykoStudio) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import torch +import numpy as np +from PIL import Image + +def pil2tensor(image): + return torch.from_numpy(np.array(image).astype(np.float32) / 255.0).unsqueeze(0) + +def tensor2pil(t_image): + return Image.fromarray(np.clip(255.0 * t_image.cpu().numpy().squeeze(), 0, 255).astype(np.uint8)) + +class RSTileImage: + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "image": ("IMAGE",), + "width_factor_tile": ("INT", {"default": 3, "min": 1, "max": 10, "step": 1}), + "height_factor_tile": ("INT", {"default": 3, "min": 1, "max": 10, "step": 1}), + "overlap_rate": ("FLOAT", {"default": 0.1, "min": 0.00, "max": 0.95, "step": 0.05}), + } + } + + RETURN_TYPES = ("IMAGE", "LIST", "TUPLE", "TUPLE", "INT", "INT") + RETURN_NAMES = ("IMAGES", "POSITIONS", "ORIGINAL_SIZE", "GRID_SIZE", "tile_width", "tile_height") + FUNCTION = "process" + CATEGORY = "🦊 RaykoStudio" + DESCRIPTION = "Calculates tile size based on factors/overlap and splits the image into a batch of tiles." + + def calculate_tile_size(self, raw_size, factor, overlap_rate): + if overlap_rate == 0: + if factor == 1: + tile_size = raw_size + else: + tile_size = int(raw_size / factor) + else: + if factor == 1: + tile_size = raw_size + else: + tile_size = int(raw_size / (1 + (factor - 1) * (1 - overlap_rate))) + + if tile_size % 8 != 0: + tile_size = ((tile_size + 7) // 8) * 8 + + return max(8, tile_size) + + def process(self, image, width_factor_tile, height_factor_tile, overlap_rate): + _, raw_H, raw_W, _ = image.shape + + tile_width = self.calculate_tile_size(raw_W, width_factor_tile, overlap_rate) + tile_height = self.calculate_tile_size(raw_H, height_factor_tile, overlap_rate) + + pil_image = tensor2pil(image[0].unsqueeze(0)) + img_width, img_height = pil_image.size + + if img_width <= tile_width and img_height <= tile_height: + return ( + image, + [(0, 0, img_width, img_height)], + (img_width, img_height), + (1, 1), + tile_width, + tile_height + ) + + def calculate_step(size, tile_size): + if size <= tile_size: + return 1, 0 + else: + num_tiles = (size + tile_size - 1) // tile_size + overlap = (num_tiles * tile_size - size) // (num_tiles - 1) + step = tile_size - overlap + return num_tiles, step + + num_cols, step_x = calculate_step(img_width, tile_width) + num_rows, step_y = calculate_step(img_height, tile_height) + + tiles = [] + positions = [] + + for y in range(num_rows): + for x in range(num_cols): + left = x * step_x + upper = y * step_y + right = min(left + tile_width, img_width) + lower = min(upper + tile_height, img_height) + + if right - left < tile_width: + left = max(0, img_width - tile_width) + right = img_width + if lower - upper < tile_height: + upper = max(0, img_height - tile_height) + lower = img_height + + tile = pil_image.crop((left, upper, right, lower)) + tile_tensor = pil2tensor(tile) + tiles.append(tile_tensor) + positions.append((left, upper, right, lower)) + + if tiles: + tiles_batch = torch.cat(tiles, dim=0) + else: + tiles_batch = image + + return ( + tiles_batch, + positions, + (img_width, img_height), + (num_cols, num_rows), + tile_width, + tile_height + ) + +NODE_CLASS_MAPPINGS = { + "RSTileImage": RSTileImage +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "RSTileImage": "🦊 RS Tile Adjustments" +} \ No newline at end of file diff --git a/Rayko_Tile_Assemble.py b/Rayko_Tile_Assemble.py new file mode 100644 index 0000000..606125f --- /dev/null +++ b/Rayko_Tile_Assemble.py @@ -0,0 +1,169 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2025-2026 Raykosan (RaykoStudio) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import torch +import numpy as np +from PIL import Image + +def pil2tensor(image): + image = image.convert("RGB") + return torch.from_numpy(np.array(image).astype(np.float32) / 255.0).unsqueeze(0) + +def tensor2pil(t_image): + if t_image.dim() == 4: + t_image = t_image[0] + i = t_image.cpu().numpy() + i = np.clip(i * 255.0, 0, 255).astype(np.uint8) + return Image.fromarray(i, mode='RGB') + +class RSTileAssemble: + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "tiles": ("IMAGE",), + "positions": ("LIST",), + "original_size": ("TUPLE",), + "grid_size": ("TUPLE",), + "feather_size": ("INT", {"default": 64, "min": 0, "max": 512, "step": 8}), + } + } + + RETURN_TYPES = ("IMAGE",) + RETURN_NAMES = ("FINAL_IMAGE",) + FUNCTION = "assemble" + CATEGORY = "🦊 RaykoStudio" + DESCRIPTION = "Assembles a batch of processed tiles back into a single image using calculated positions and feathered blending." + + def create_gradient_mask(self, size, direction): + mask = Image.new("L", size) + for i in range(size[0] if direction == 'horizontal' else size[1]): + value = int(255 * (1 - (i / size[0] if direction == 'horizontal' else i / size[1]))) + if direction == 'horizontal': + mask.paste(value, (i, 0, i+1, size[1])) + else: + mask.paste(value, (0, i, size[0], i+1)) + return mask + + def blend_tiles(self, tile1, tile2, overlap_size, direction, padding): + blend_size = padding + if blend_size > overlap_size: + blend_size = overlap_size + + if blend_size == 0: + if direction == 'horizontal': + result = Image.new("RGB", (tile1.width + tile2.width - overlap_size, tile1.height)) + result.paste(tile1.crop((0, 0, tile1.width - overlap_size, tile1.height)), (0, 0)) + result.paste(tile2, (tile1.width - overlap_size, 0)) + else: + result = Image.new("RGB", (tile1.width, tile1.height + tile2.height - overlap_size)) + result.paste(tile1.crop((0, 0, tile1.width, tile1.height - overlap_size)), (0, 0)) + result.paste(tile2, (0, tile1.height - overlap_size)) + return result + + offset_total = overlap_size - blend_size + offset_left = offset_total // 2 + offset_right = offset_total - offset_left + + size = (blend_size, tile1.height) if direction == 'horizontal' else (tile1.width, blend_size) + mask = self.create_gradient_mask(size, direction) + + if direction == 'horizontal': + crop_tile1 = tile1.crop((tile1.width - overlap_size + offset_left, 0, tile1.width - offset_right, tile1.height)) + crop_tile2 = tile2.crop((offset_left, 0, offset_left + blend_size, tile2.height)) + + if crop_tile1.size != crop_tile2.size: + crop_tile2 = crop_tile2.resize(crop_tile1.size) + + blended = Image.composite(crop_tile1, crop_tile2, mask) + + result = Image.new("RGB", (tile1.width + tile2.width - overlap_size, tile1.height)) + result.paste(tile1.crop((0, 0, tile1.width - overlap_size + offset_left, tile1.height)), (0, 0)) + result.paste(blended, (tile1.width - overlap_size + offset_left, 0)) + result.paste(tile2.crop((offset_left + blend_size, 0, tile2.width, tile2.height)), (tile1.width - offset_right, 0)) + else: + offset_top = offset_total // 2 + offset_bottom = offset_total - offset_top + size = (tile1.width, blend_size) + mask = self.create_gradient_mask(size, direction) + + crop_tile1 = tile1.crop((0, tile1.height - overlap_size + offset_top, tile1.width, tile1.height - offset_bottom)) + crop_tile2 = tile2.crop((0, offset_top, tile2.width, offset_top + blend_size)) + + if crop_tile1.size != crop_tile2.size: + crop_tile2 = crop_tile2.resize(crop_tile1.size) + + blended = Image.composite(crop_tile1, crop_tile2, mask) + + result = Image.new("RGB", (tile1.width, tile1.height + tile2.height - overlap_size)) + result.paste(tile1.crop((0, 0, tile1.width, tile1.height - overlap_size + offset_top)), (0, 0)) + result.paste(blended, (0, tile1.height - overlap_size + offset_top)) + result.paste(tile2.crop((0, offset_top + blend_size, tile2.width, tile2.height)), (0, tile1.height - offset_bottom)) + + return result + + def assemble(self, tiles, positions, original_size, grid_size, feather_size): + num_cols, num_rows = grid_size + + row_images = [] + for row in range(num_rows): + row_image = tensor2pil(tiles[row * num_cols].unsqueeze(0)) + for col in range(1, num_cols): + index = row * num_cols + col + tile_image = tensor2pil(tiles[index].unsqueeze(0)) + + prev_right = positions[index - 1][2] + left = positions[index][0] + overlap_width = prev_right - left + + if overlap_width > 0: + row_image = self.blend_tiles(row_image, tile_image, overlap_width, 'horizontal', feather_size) + else: + new_width = row_image.width + tile_image.width + new_height = max(row_image.height, tile_image.height) + new_row_image = Image.new("RGB", (new_width, new_height)) + new_row_image.paste(row_image, (0, 0)) + new_row_image.paste(tile_image, (row_image.width, 0)) + row_image = new_row_image + row_images.append(row_image) + + final_image = row_images[0] + for row in range(1, num_rows): + prev_lower = positions[(row - 1) * num_cols][3] + upper = positions[row * num_cols][1] + overlap_height = prev_lower - upper + + if overlap_height > 0: + final_image = self.blend_tiles(final_image, row_images[row], overlap_height, 'vertical', feather_size) + else: + new_width = max(final_image.width, row_images[row].width) + new_height = final_image.height + row_images[row].height + new_final_image = Image.new("RGB", (new_width, new_height)) + new_final_image.paste(final_image, (0, 0)) + new_final_image.paste(row_images[row], (0, final_image.height)) + final_image = new_final_image + + return (pil2tensor(final_image),) + +NODE_CLASS_MAPPINGS = { + "RSTileAssemble": RSTileAssemble +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "RSTileAssemble": "🦊 RS Tile Assemble" +} \ No newline at end of file diff --git a/Rayko_Upscale_Resize.py b/Rayko_Upscale_Resize.py new file mode 100644 index 0000000..f47b393 --- /dev/null +++ b/Rayko_Upscale_Resize.py @@ -0,0 +1,160 @@ +import torch +import torch.nn.functional as F +import comfy.utils +from nodes import MAX_RESOLUTION + +class RSUpscaleResize: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": ("IMAGE",), + + "width": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 1}), + "height": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 1}), + + "upscale_method": (["lanczos", "bicubic", "bilinear", "nearest-exact", "area"], {"default": "lanczos"}), + "scale_by": ("FLOAT", {"default": 2.0, "min": 0.01, "max": 8.0, "step": 0.01}), + + "method": (["stretch", "keep proportion", "fill / crop", "pad"], {"default": "stretch"}), + "condition": (["always", "downscale if bigger", "upscale if smaller", "if bigger area", "if smaller area"], {"default": "always"}), + "multiple_of": ([8, 16, 32, 64], {"default": 8}), + } + } + + RETURN_TYPES = ("IMAGE", "INT", "INT") + RETURN_NAMES = ("IMAGE", "width", "height") + FUNCTION = "execute" + CATEGORY = "🦊 RaykoStudio" + DESCRIPTION = "Hybrid upscaler and resizer. Uses 'scale_by' by default. When width/height inputs are connected or set manually (>0), it switches to exact external dimensions." + + def execute(self, image, width, height, upscale_method, scale_by, method, condition, multiple_of): + _, oh, ow, _ = image.shape + + use_external = (width > 0) or (height > 0) + + if use_external: + if width > 0 and height == 0: + target_w = width + target_h = round(oh * (width / ow)) + elif height > 0 and width == 0: + target_h = height + target_w = round(ow * (height / oh)) + else: + target_w = width if width > 0 else ow + target_h = height if height > 0 else oh + else: + target_w = round(ow * scale_by) + target_h = round(oh * scale_by) + + target_w = min(target_w, MAX_RESOLUTION) + target_h = min(target_h, MAX_RESOLUTION) + + x = y = x2 = y2 = 0 + pad_left = pad_right = pad_top = pad_bottom = 0 + + if method == 'keep proportion' or method == 'pad': + if target_w == 0 and oh < target_h: + target_w = MAX_RESOLUTION + elif target_w == 0 and oh >= target_h: + target_w = ow + + if target_h == 0 and ow < target_w: + target_h = MAX_RESOLUTION + elif target_h == 0 and ow >= target_w: + target_h = oh + + ratio = min(target_w / ow, target_h / oh) + new_width = round(ow * ratio) + new_height = round(oh * ratio) + + if method == 'pad': + pad_left = (target_w - new_width) // 2 + pad_right = target_w - new_width - pad_left + pad_top = (target_h - new_height) // 2 + pad_bottom = target_h - new_height - pad_top + + target_w = new_width + target_h = new_height + + elif method.startswith('fill'): + target_w = target_w if target_w > 0 else ow + target_h = target_h if target_h > 0 else oh + ratio = max(target_w / ow, target_h / oh) + new_width = round(ow * ratio) + new_height = round(oh * ratio) + x = (new_width - target_w) // 2 + y = (new_height - target_h) // 2 + x2 = x + target_w + y2 = y + target_h + + if x2 > new_width: + x -= (x2 - new_width) + if x < 0: + x = 0 + if y2 > new_height: + y -= (y2 - new_height) + if y < 0: + y = 0 + + target_w = new_width + target_h = new_height + else: + target_w = target_w if target_w > 0 else ow + target_h = target_h if target_h > 0 else oh + + should_resize = False + if "always" in condition: + should_resize = True + elif "downscale if bigger" == condition and (oh > target_h or ow > target_w): + should_resize = True + elif "upscale if smaller" == condition and (oh < target_h or ow < target_w): + should_resize = True + elif "bigger area" in condition and (oh * ow > target_h * target_w): + should_resize = True + elif "smaller area" in condition and (oh * ow < target_h * target_w): + should_resize = True + + outputs = image + if should_resize: + outputs = image.permute(0, 3, 1, 2) + + if upscale_method == "lanczos": + outputs = comfy.utils.lanczos(outputs, target_w, target_h) + else: + outputs = F.interpolate(outputs, size=(target_h, target_w), mode=upscale_method) + + if method == 'pad': + if pad_left > 0 or pad_right > 0 or pad_top > 0 or pad_bottom > 0: + outputs = F.pad(outputs, (pad_left, pad_right, pad_top, pad_bottom), value=0) + + outputs = outputs.permute(0, 2, 3, 1) + + if method.startswith('fill'): + if x > 0 or y > 0 or x2 > 0 or y2 > 0: + outputs = outputs[:, y:y2, x:x2, :] + else: + outputs = image + + final_w = outputs.shape[2] + final_h = outputs.shape[1] + + if multiple_of > 1 and (final_w % multiple_of != 0 or final_h % multiple_of != 0): + x_crop = (final_w % multiple_of) // 2 + y_crop = (final_h % multiple_of) // 2 + x2_crop = final_w - ((final_w % multiple_of) - x_crop) + y2_crop = final_h - ((final_h % multiple_of) - y_crop) + outputs = outputs[:, y_crop:y2_crop, x_crop:x2_crop, :] + + outputs = torch.clamp(outputs, 0, 1) + + return (outputs, outputs.shape[2], outputs.shape[1]) + + +NODE_CLASS_MAPPINGS = { + "RSUpscaleResize": RSUpscaleResize +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "RSUpscaleResize": "🦊 RS Upscale & Resize" +} \ No newline at end of file diff --git a/Rayko_Upscaler.py b/Rayko_Upscaler.py index 7d72904..8d009fc 100644 --- a/Rayko_Upscaler.py +++ b/Rayko_Upscaler.py @@ -40,11 +40,25 @@ class RSUpscaler: RETURN_TYPES = ("IMAGE",) FUNCTION = "upscale" CATEGORY = "🦊 RaykoStudio" - DESCRIPTION = "Node for that combines upscale model loading and image upscaling into a single compact node" + + @classmethod + def VALIDATE_INPUTS(cls, upscale_model, upscale_method, upscale_x, **kwargs): + model_list = folder_paths.get_filename_list("upscale_models") + + if not upscale_model or upscale_model not in model_list: + if model_list: + return True + return "No upscale models found in models/upscale_models/" + + valid_methods = ["nearest-exact", "bilinear", "area", "bicubic", "lanczos"] + if upscale_method not in valid_methods: + return True + + return True def upscale(self, image, upscale_model, upscale_method, upscale_x, rs_node_type=None): - if not upscale_model: - model_list = folder_paths.get_filename_list("upscale_models") + model_list = folder_paths.get_filename_list("upscale_models") + if not upscale_model or upscale_model not in model_list: if model_list: upscale_model = model_list[0] else: diff --git a/__init__.py b/__init__.py index 076b2f0..f79df5b 100644 --- a/__init__.py +++ b/__init__.py @@ -29,7 +29,7 @@ IGNORED_MODULES: Set[str] = {'__init__.py'} REQUIRED_MODULES: Set[str] = set() PACKAGE_DISPLAY_NAME = "ComfyUI_RaykoStudio" -__version__ = "0.41.0" +__version__ = "0.42.0" def load_modules(): print(f"🦊 {PACKAGE_DISPLAY_NAME}: Version: {__version__}") diff --git a/package.json b/package.json index c4a22dc..fe83455 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ComfyUI_RaykoStudio", - "version": "0.41.0", + "version": "0.42.0", "description": "Set of custom nodes for ComfyUI providing additional image processing capabilities", "author": "Raykosan", "license": "Apache License 2.0", @@ -38,11 +38,14 @@ "Rayko_Reference_Encode.py" "Rayko_RGB2RGBA.py" "Rayko_Save_Image.py" - "Rayko_Save_Image_Pair.py" "Rayko_Save_Image_LoRA.py" + "Rayko_Save_Image_Pair.py" "Rayko_Spline_Mask.py" "Rayko_Styles_Loader.py" "Rayko_Text_Overlay_Pro.py" + "Rayko_Tile_Adjustments.py" + "Rayko_Tile_Assemble.py" + "Rayko_Upscale_Resize.py" "Rayko_Upscaler.py" "Rayko_VAE_Save_Image.py" "rayko_api.py" diff --git a/pyproject.toml b/pyproject.toml index d476aee..9c5a760 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "ComfyUI_RaykoStudio" description = "Set of custom nodes for ComfyUI providing additional image processing capabilities" -version = "0.41.0" +version = "0.42.0" license = { file = "LICENSE" } dependencies = ["torch", "numpy", "Pillow>=10.0.0", "freetype-py>=2.5.1", "pycairo>=1.29.0", "scipy>=1.10.0"] diff --git a/web/rs_upscaler.js b/web/rs_upscaler.js index 7c14a96..76e83a4 100644 --- a/web/rs_upscaler.js +++ b/web/rs_upscaler.js @@ -10,6 +10,7 @@ const NODE_HEIGHT = 130; function getScopedStyles(scopeId) { return ` + /* === Container === */ .${scopeId} .rs-row { display: flex; align-items: center; @@ -41,6 +42,7 @@ function getScopedStyles(scopeId) { .${scopeId} .rs-row select:hover { border-color: #ff9800; } .${scopeId} .rs-row select:focus { border-color: #ff9800; box-shadow: 0 0 0 1px rgba(255,152,0,0.3); } + /* === Slider row === */ .${scopeId} .rs-slider-row { display: flex; align-items: center; @@ -56,6 +58,7 @@ function getScopedStyles(scopeId) { font-family: sans-serif; } + /* Slider: green fill + white handle */ .${scopeId} .rs-slider-row input[type="range"] { flex: 1; min-width: 0; @@ -100,6 +103,7 @@ function getScopedStyles(scopeId) { box-shadow: 0 1px 3px rgba(0,0,0,0.4); } + /* === Step buttons +/- === */ .${scopeId} .rs-step-btn { width: 20px; height: 26px; @@ -127,6 +131,7 @@ function getScopedStyles(scopeId) { background: #333; } + /* === Value input === */ .${scopeId} .rs-value-input { width: 35px; min-width: 35px; @@ -305,7 +310,7 @@ app.registerExtension({ models.forEach((m) => { const opt = document.createElement("option"); opt.value = m; - opt.textContent = m.replace(/\.(pth|bin|pt)$/i, ""); + opt.textContent = m.replace(/\.(pth|bin|pt|safetensors)$/i, ""); modelSelect.appendChild(opt); }); const currentModel = this.widgets.find((w) => w.name === "upscale_model")?.value;