Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ This node merges all tiled conditions into one and prepares them for building th

---

### **7. Iterative Upscale Node**
This node crops and upscales an image multiple times. Use it together with **TTP_Expand_And_Mask** to create an infinite zoom effect.

| Parameter | Description |
|-----------|-------------|
| **Iterations** | Number of upscale cycles. |
| **Scale Factor** | Factor used for each upscale step. |
| **Crop X/Y/Width/Height** | Optional region to crop before scaling. |

**Example Chain**: `TTP_Expand_And_Mask → TTP_Iterative_Upscale` (repeat as needed)

---

## **Examples**

### **Pixel Example (Recommended)**
Expand Down
68 changes: 56 additions & 12 deletions TTP_toolsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,50 @@ def sample(self, noise, guider, sampler, sigmas, latent_image, speedup, enable_c

return (out, out_denoised)

except Exception as e:
raise RuntimeError(f"Sampling failed: {str(e)}")
except Exception as e:
raise RuntimeError(f"Sampling failed: {str(e)}")


class TTP_Iterative_Upscale:
def __init__(self, *args, **kwargs):
pass

@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image": ("IMAGE",),
"iterations": ("INT", {"default": 1, "min": 1, "max": 10, "step": 1}),
"scale_factor": ("FLOAT", {"default": 2.0, "min": 1.0, "max": 4.0, "step": 0.05}),
},
"optional": {
"crop_x": ("INT", {"default": 0, "min": 0}),
"crop_y": ("INT", {"default": 0, "min": 0}),
"crop_width": ("INT", {"default": 0, "min": 0}),
"crop_height": ("INT", {"default": 0, "min": 0}),
}
}

RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("IMAGE",)
FUNCTION = "iter_upscale"
CATEGORY = "TTP/Image"

def iter_upscale(self, image, iterations=1, scale_factor=2.0, crop_x=0, crop_y=0, crop_width=0, crop_height=0):
pil_img = tensor2pil(image)

for _ in range(iterations):
if crop_width > 0 and crop_height > 0:
left = max(0, crop_x)
top = max(0, crop_y)
right = min(pil_img.width, crop_x + crop_width)
bottom = min(pil_img.height, crop_y + crop_height)
pil_img = pil_img.crop((left, top, right, bottom))

new_size = (int(pil_img.width * scale_factor), int(pil_img.height * scale_factor))
pil_img = pil_img.resize(new_size, Image.LANCZOS)

return (pil2tensor(pil_img),)

NODE_CLASS_MAPPINGS = {
"TTPlanet_Tile_Preprocessor_Simple": TTPlanet_Tile_Preprocessor_Simple,
Expand All @@ -1107,11 +1149,12 @@ def sample(self, noise, guider, sampler, sigmas, latent_image, speedup, enable_c
"TTP_condtobatch": TTP_condtobatch,
"TTP_condsetarea_merge": TTP_condsetarea_merge,
"TTP_Tile_image_size": Tile_imageSize,
"TTP_condsetarea_merge_test": TTP_condsetarea_merge_test,
"TTP_Expand_And_Mask": TTP_Expand_And_Mask,
"TTP_text_mix": TTP_text_mix,
"TeaCacheHunyuanVideoSampler": TeaCacheHunyuanVideoSampler
}
"TTP_condsetarea_merge_test": TTP_condsetarea_merge_test,
"TTP_Expand_And_Mask": TTP_Expand_And_Mask,
"TTP_Iterative_Upscale": TTP_Iterative_Upscale,
"TTP_text_mix": TTP_text_mix,
"TeaCacheHunyuanVideoSampler": TeaCacheHunyuanVideoSampler
}

NODE_DISPLAY_NAME_MAPPINGS = {
"TTPlanet_Tile_Preprocessor_Simple": "TTP Tile Preprocessor Simple",
Expand All @@ -1121,8 +1164,9 @@ def sample(self, noise, guider, sampler, sigmas, latent_image, speedup, enable_c
"TTP_condtobatch": "TTP_cond to batch",
"TTP_condsetarea_merge": "TTP_condsetarea_merge",
"TTP_Tile_image_size": "TTP_Tile_image_size",
"TTP_condsetarea_merge_test": "TTP_condsetarea_merge_test",
"TTP_Expand_And_Mask": "TTP_Expand_And_Mask",
"TTP_text_mix": "TTP_text_mix",
"TeaCacheHunyuanVideoSampler": "TTP_TeaCache HunyuanVideo Sampler"
}
"TTP_condsetarea_merge_test": "TTP_condsetarea_merge_test",
"TTP_Expand_And_Mask": "TTP_Expand_And_Mask",
"TTP_Iterative_Upscale": "TTP_Iterative_Upscale",
"TTP_text_mix": "TTP_text_mix",
"TeaCacheHunyuanVideoSampler": "TTP_TeaCache HunyuanVideo Sampler"
}