⚠️ DEPRECATED — succeeded by ComfyUI-ContextAnchoredTileRefine. The successor is a complete native rewrite from scratch using a more efficient and deterministic tiling method with less overhead. It has improved and reworked versions of Context Only Overlap + context anchoring that are always on, along with per-image mask batches, active-row batch sampling, and none of the legacy machinery. This repo remains available for existing workflows. This is only a single refiner node, so you handle the upscaling yourself. I also calculates the best tile size for you based on the image, you just provide the max tile size. This way no processing or context is wasted is wasted by shoehorning a single tile size into all images. You will have faster and higher quality upscaled and refined images using the new node, so I highly recommend switching.
A fork of ComfyUI_UltimateSDUpscale with Guider support, Context Only Overlap, Masked Upscaling, and context anchoring.
ComfyUI nodes for running the image-to-image diffusion process on large images in tiles. Tiling improves the detail commonly lost on upscaled images while keeping VRAM use low and the working size close to what the diffusion model was trained on.
- Guider input support: drive tiled upscaling with any custom guider. For example, PerpNegGuider enables negative prompts at CFG 1 for higher quality upscales.
- Context Only Overlap mode: tiles use already-generated neighbor pixels as context without re-denoising them, which greatly improves consistency and removes seams.
- Masked Upscaling: an optional mask restricts re-diffusion to a region, so different parts of an image can be upscaled with different models or settings, or an inpainted patch refined to match its surroundings.
- Context anchoring (
anchor_context): holds unprocessed areas to the original image during sampling, preventing detail drift between sections and joining seams to the real image.
| Node | Description |
|---|---|
| Ultimate SD Upscale (Guider) | Full upscaling with guider support |
| Ultimate SD Upscale (No Upscale, Guider) | Tile refinement without initial upscaling, with guider support |
The Guider nodes accept:
- GUIDER: encapsulates model, conditioning, and CFG (from PerpNegGuider, CFGGuider, etc.)
- SAMPLER: from KSamplerSelect
- SIGMAS: from BasicScheduler or other scheduler nodes (configure denoise here)
These replace the standard nodes' separate model, positive, negative, cfg, sampler_name, scheduler, steps, and denoise inputs.
[KSamplerSelect] ──────────────────────────┐
[BasicScheduler (with denoise)] ───────────┤
[PerpNegGuider] ───────────────────────────┤
[Load VAE] ────────────────────────────────┼──► [Ultimate SD Upscale (Guider)] ──► IMAGE
[Load Upscale Model] ──────────────────────┤
[Image] ───────────────────────────────────┘
The Guider nodes skip per-tile conditioning cropping since conditioning is internal to the guider. This works for text-based guiders (PerpNegGuider, CFGGuider). For spatial conditioning (ControlNet, GLIGEN), use the original non-Guider nodes instead.
Tiles are processed independently, so pixels at tile boundaries are generated separately and can show seams. The usual remedy is a seam fix pass, which costs extra time and can blur.
Context Only Overlap prevents the seams instead of fixing them afterward:
- Each tile extends into its neighbors by the
tile_paddingamount. - Already-denoised overlap regions are used as context for the attention mechanism but are not re-denoised.
- Each tile sees what its neighbors generated and continues it coherently, including at edge and corner tiles.
| Mode | Description | Use Case |
|---|---|---|
| Ignore Overlap | Tiles use minimal size, no overlap handling | Fastest, may have visible seams |
| Reprocess Overlap | Uniform tile sizes, overlap regions may be generated independently | Original behavior, seams possible |
| Context Only Overlap | Overlap regions provide context without re-denoising | Best coherence, no seam fix blur |
- Set
tile_overlap_modeto "Context Only Overlap" - Use a
tile_paddingof 64-128 pixels (this becomes the overlap width) mask_blurof 8-16 provides smooth blending at tile edges- Seam fix can typically be set to "None" since seams are prevented
- Enable
anchor_contextto hold the overlap context fixed during sampling as well, not just at composite time (see Anchoring Context below)
Both Guider nodes accept an optional mask input. White areas are re-diffused; black areas are left untouched. With no mask connected, behavior is unchanged.
- Tile skipping. Tiles that do not touch the mask are skipped entirely, with no VAE encode and no sampling, so a small region only pays for the tiles it touches.
- Full tile context. Processed tiles still see the whole tile, so the re-diffused region blends with its real surroundings.
- Same feathering as tile seams. The mask is feathered by
mask_blur, and the edit extends aboutmask_blurpixels past the mask edge. Usemask_blur=0for a hard boundary. - Any resolution. The mask is resized to the upscaled canvas, so it can be drawn on the pre-upscale image. Grayscale values give partial blending.
- Batched images. A batch of images works as usual. A single mask applies to every image in the batch; a batch of masks maps one mask to each image, so each image is edited only in its own region (a tile is sampled when any image in the batch needs it). With
anchor_context, each image is anchored to its own original content.
By default, areas a tile will not keep are still re-diffused during sampling and thrown away afterward, so the model works against a re-imagined version of the surroundings that can drift from the real image. Enabling anchor_context holds those areas to the original image at every sampling step, so the model always sees the true surroundings.
In practice:
- Details stay consistent across sections instead of drifting apart during denoising, giving a more even and slightly sharper result across the whole image.
- Seams blend better because new content is joined to the real image rather than to a drifted version of it.
- Anchoring applies only to pixels the composite will not replace; everything that gets composited is still fully refined.
- Takes effect when a mask is connected or
tile_overlap_modeis "Context Only Overlap"; otherwise it does nothing.
- Works with all three
tile_overlap_modevalues and all seam fix modes (seam fix passes are clipped to the masked region the same way). - Not compatible with
batch_size > 1; the node raises an error. Usebatch_size=1with a mask. Note thatbatch_sizeis the number of tiles sampled per call — batched images are fully supported (see above).
Upscale the background and a character with different guider/sampler/sigmas each, in one chained workflow. Run the background pass first so the character pass sees the finished background as tile context:
[Mask] ──► [InvertMask] ──► mask ┐
[Background Guider/Sampler/Sigmas] ┼──► [Ultimate SD Upscale (Guider)] ─┐
[Image] ───────────────────────────┘ │
▼
[Mask] ────────────────────► mask ┬──► [Ultimate SD Upscale (No Upscale, Guider)] ──► IMAGE
[Character Guider/Sampler/Sigmas] ┘
Inpainting a huge image directly is expensive. Instead: downsample a copy, inpaint on the small copy, paste the upscaled patch back into the full-size image, then use the No Upscale node with a mask over the patched region to re-diffuse only that region so it matches the rest:
[Huge Image] ─► [Downscale] ─► [Inpaint] ─► [Upscale patch + paste back] ─┐
▼
[Patch-Region Mask] ─► mask ──► [Ultimate SD Upscale (No Upscale, Guider)] ──► IMAGE
- Git must be installed on your system. Verify by running
git -vin a terminal. - Enter the following command from the terminal starting in ComfyUI/custom_nodes/
git clone https://github.com/Blakeem/ComfyUI_UltimateSDUpscaleGuider
- Download the zip file by clicking the green "Code" button on the GitHub repository page and selecting "Download ZIP".
- Create a new folder in the
ComfyUI/custom_nodes/directory (e.g.ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscaleGuider). - Extract the contents of the zip file into that folder.
If you don't need Guider support, you can install the original version:
- Via ComfyUI Manager: Search for "UltimateSDUpscale"
- Via comfy-cli:
comfy node install comfyui_ultimatesdupscale - Via Git:
git clone https://github.com/ssitu/ComfyUI_UltimateSDUpscale
Nodes can be found in the node menu under image/upscaling.
Documentation for the nodes can be found in the js/docs/ folder, or viewed within the application by right-clicking the relevant node and selecting the info icon.
Details about most of the parameters can be found here.
Example workflows can be found in the example_workflows/ folder. You can also find them in the ComfyUI application under the Templates menu, scroll down the left sidebar to find the Extensions section, then selecting this repository.
- Upstream fork: https://github.com/ssitu/ComfyUI_UltimateSDUpscale
- Ultimate Stable Diffusion Upscale script for the Automatic1111 Web UI: https://github.com/Coyote-A/ultimate-upscale-for-automatic1111
- ComfyUI: https://github.com/comfyanonymous/ComfyUI