Merge pull request #174 from ssitu/initial-docs

Add in-app docs
This commit is contained in:
ssitu
2025-12-20 13:10:59 -05:00
committed by GitHub
8 changed files with 324 additions and 50 deletions
+30 -22
View File
@@ -1,35 +1,43 @@
# ComfyUI_UltimateSDUpscale
[ComfyUI](https://github.com/comfyanonymous/ComfyUI) nodes for the [Ultimate Stable Diffusion Upscale script by Coyote-A](https://github.com/Coyote-A/ultimate-upscale-for-automatic1111). This is a wrapper for the script used in the A1111 extension.
[ComfyUI](https://github.com/comfyanonymous/ComfyUI) nodes for performing the image-to-image diffusion process on large images in tiles. This approach improves the details that is commonly found on upscaled images while reducing hardware requirements and maintaining an image size that the diffusion model is trained on.
## Installation
Enter the following command from the commandline starting in ComfyUI/custom_nodes/
```
git clone https://github.com/ssitu/ComfyUI_UltimateSDUpscale --recursive
```
### Using Git
1. Git must be installed on your system. Verify by running `git -v` in a terminal.
2. Enter the following command from the terminal starting in ComfyUI/custom_nodes/
```
git clone https://github.com/ssitu/ComfyUI_UltimateSDUpscale
```
### ComfyUI Manager
1. [ComfyUI Manager](https://github.com/Comfy-Org/ComfyUI-Manager) must be installed.
2. After launching ComfyUI, open ComfyUI Manager and select the "Custom Nodes Manager" option.
3. Search for "UltimateSDUpscale" and install the node. Select latest for the most up-to-date version.
4. Follow any prompts to restart ComfyUI.
### comfy-cli
1. [comfy-cli](https://github.com/Comfy-Org/comfy-cli) must be installed.
2. Run this command from the terminal: `comfy node install comfyui_ultimatesdupscale`
### Manual Download
1. Download the zip file from https://registry.comfy.org/nodes/comfyui_ultimatesdupscale to select the version you want, or obtain the current nightly version by clicking the green "Code" button on the GitHub repository page and selecting "Download ZIP".
2. Create a new folder in the `ComfyUI/custom_nodes/` directory to hold the extracted files (e.g. `ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale`).
3. Extract the contents of the zip file into the `ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale` folder.
## Usage
Nodes can be found in the node menu under `image/upscaling`:
Nodes can be found in the node menu under `image/upscaling`.
|Node|Description|
| --- | --- |
| Ultimate SD Upscale | The primary node that has the most of the inputs as the original extension script. |
| Ultimate SD Upscale <br>(No Upscale) | Same as the primary node, but without the upscale inputs and assumes that the input image is already upscaled. Use this if you already have an upscaled image or just want to do the tiled sampling. |
| Ultimate SD Upscale <br>(Custom Sample) | Same as the primary node, but has additional inputs for a custom sampler and custom sigmas. Both must be provided if one is used. If neither is provided, the widgets (the settings below the input slots) for the sampler and step/denoise settings will be used, like in the base USDU node. |
---
Documentation for the nodes can be found in the [`js/docs/`](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](https://github.com/Coyote-A/ultimate-upscale-for-automatic1111/wiki/FAQ#parameters-descriptions).
Parameters not found in the original repository:
* `upscale_by` The number to multiply the width and height of the image by. If you want to specify an exact width and height, use the "No Upscale" version of the node and perform the upscaling separately (e.g., ImageUpscaleWithModel -> ImageScale -> UltimateSDUpscaleNoUpscale).
* `force_uniform_tiles` If enabled, tiles that would be cut off by the edges of the image will expand the tile using the rest of the image to keep the same tile size determined by `tile_width` and `tile_height`, which is what the A1111 Web UI does. If disabled, the minimal size for tiles will be used, which may make the sampling faster but may cause artifacts due to irregular tile sizes.
## Examples
#### Using the ControlNet tile model:
![image](https://github.com/ssitu/ComfyUI_UltimateSDUpscale/assets/57548627/64f8d3b2-10ae-45ee-9f8a-40b798a51655)
## References
* 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
+2
View File
@@ -57,6 +57,8 @@ for module in modules_used:
# Proceed with node setup
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
WEB_DIRECTORY = "./js"
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
# Clean up imports
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

+73
View File
@@ -0,0 +1,73 @@
`Ultimate SD Upscale` combines image upscaling with tiled image-to-image processing to create high-quality, detail-enhanced upscaled images.
This is the main node that interfaces with the original code for the Ultimate SD Upscale script. An image is supplied for upscaling, determined by the upscale_by parameter. The upscale is performed using the upscale model input.
After the upscaling, the image goes through the redraw step if the tiling order is not set to "None". A tile is selected from the image, defined by the tiling order and tile parameters from the node widgets. The tile is used as input for an image-to-image process, using the sampling-related parameters given by the node widgets. The tile is then pasted back onto the upscaled image at the appropriate position. This continues until all tiles have been processed.
After the redraw step, the seam fix step is applied if enabled. There are various strategies for fixing seams, defined by the seam_fix_mode parameter from the node widgets. The seam fix step uses the same image-to-image process as the redraw step, but applied to areas between tiles from the redraw step.
## Inputs
| Parameter | Data Type | Input Method | Default | Range | Description |
|-----------|-----------|--------------|---------|--------|-------------|
| image | IMAGE | Image Input | None | - | The image to upscale. |
| model | MODEL | Model Selection | None | - | The model to use for image-to-image processing on each tile. |
| positive | CONDITIONING | Conditioning Input | None | - | The positive conditioning for each tile during the redraw step. |
| negative | CONDITIONING | Conditioning Input | None | - | The negative conditioning for each tile during the redraw step. |
| vae | VAE | Model Selection | None | - | The VAE model to use for encoding and decoding tiles. |
| upscale_by | FLOAT | Slider | 2.0 | 0.05-4.0 (step 0.05) | The factor to multiply the height and width of the input image(s) by. |
| seed | INT | Number Input | 0 | 0-18446744073709551615 | The seed to use for image-to-image processing, ensuring reproducible results. |
| steps | INT | Number Input | 20 | 1-10000 | The number of sampling steps to use for each tile during the redraw step and seam fix step. |
| cfg | FLOAT | Slider | 8.0 | 0.0-100.0 | The CFG (Classifier Free Guidance) scale to use for each tile. Higher values make the output follow the prompt more closely. The recommended values depend on the model. |
| sampler_name | COMBO | Dropdown | - | Available samplers | The sampler to use for each tile during the image-to-image process. |
| scheduler | COMBO | Dropdown | - | Available schedulers | The scheduler to use for each tile during the sampling process. |
| denoise | FLOAT | Slider | 0.2 | 0.0-1.0 (step 0.01) | The denoising strength to use for each tile. Higher values allow more creative changes, but more chance of seams. |
| upscale_model | UPSCALE_MODEL | Model Selection | None | - | The upscaler model for upscaling the image before the tiled redraw step. |
| mode_type | COMBO | Dropdown | - | Linear, Chess, None | The tiling order to use for the redraw step. Linear processes tiles row by row, Chess uses a checkerboard pattern, and None skips the redraw step. |
| tile_width | INT | Number Input | 512 | 64-8192 (step 8) | The base width of each tile during the redraw step. |
| tile_height | INT | Number Input | 512 | 64-8192 (step 8) | The base height of each tile during the redraw step. |
| mask_blur | INT | Number Input | 8 | 0-64 | The blur radius for the mask applied to tiles, helping blend tiles seamlessly. A higher value means more of the original image is retained near the seams when pasting the refined tiles back on the upscaled image. |
| tile_padding | INT | Number Input | 32 | 0-8192 (step 8) | The padding to apply to tiles, providing more context for better blending. Adds to tile size (e.g. (tile_width + tile_padding)x(tile_height + tile_padding)). |
| seam_fix_mode | COMBO | Dropdown | - | None, Band Pass, Half Tile, Half Tile + Intersections | The seam fix mode to use. Different modes apply different strategies to fix visible seams between tiles. |
| seam_fix_denoise | FLOAT | Slider | 1.0 | 0.0-1.0 (step 0.01) | The denoising strength to use for the seam fix step. |
| seam_fix_width | INT | Number Input | 64 | 0-8192 (step 8) | The width of the bands used for the Band Pass seam fix mode. |
| seam_fix_mask_blur | INT | Number Input | 8 | 0-64 | The blur radius for the seam fix mask, ensuring smooth blending. |
| seam_fix_padding | INT | Number Input | 16 | 0-8192 (step 8) | The padding to apply for the seam fix step. Adds to tile size. |
| force_uniform_tiles | BOOLEAN | Toggle | True | True/False | If enabled, tiles that would be cut off by the edges of the image will expand using context around the tile to keep the same tile size determined by `tile_width`, `tile_height`, and `tile_padding`. This is what happens in the A1111 Web UI. If disabled, the minimal size for tiles will be used, which may make the sampling faster but may cause artifacts due to irregular tile sizes. |
| tiled_decode | BOOLEAN | Toggle | False | True/False | Whether to use tiled decoding when decoding tiles. Useful when you know the ComfyUI engine will attempt a normal decode and run into an Out Of Memory error, and resorts to tiled decoding anyway. |
## Outputs
| Output Name | Data Type | Description |
|-------------|-----------|-------------|
| IMAGE | IMAGE | The final upscaled image. |
## Usage Tips
1. **Basic Usage**
- Typical tile sizes are based on the model resolutions that it is trained on, such as 512x512 for SD1.5 models. If you can generate a coherent image at that resolution, then it is a good choice for the tile size.
- If the workflow involves generating a base image, then using USDU to upscale and refine, it is common to take the base image size as the tile size for the USDU node. For example, generating a 512x512 image, then using USDU with 2x upscale and 512x512 tiles to get a final 1024x1024 image.
- If you want to specify an exact output size, use the "No Upscale" variant of the node and perform the upscaling separately (e.g., ImageUpscaleWithModel -> ImageScale -> UltimateSDUpscaleNoUpscale).
2. **Tiling Modes**
- **Linear**: Processes tiles sequentially row by row.
- **Chess**: Uses a checkerboard pattern, processing every other tile first. Can help reduce visible seams.
- **None**: Skips the redraw step entirely, only performs the initial upscale. Useful if you have an image upscaled by USDU and see seams, and only want to use the seam fix step.
3. **Denoise Settings**
- Use a lower denoise (0.05-0.2) to refine the upscaled image to be less blurry, while avoiding seams and hallucinations.
- Higher denoise values are only usable when using something like a ControlNet tile model to avoid tiles and seams.
4. **Seam Fix Modes**
- **None**: No seam fixing applied
- **Band Pass**: Applies processing to band-like areas between tiles
- **Half Tile**: Processes half-tile overlapping regions
- **Half Tile + Intersections**: Most thorough, processes half-tiles and their intersections
5. **Performance Optimization**
- Enable `tiled_decode` if you're running out of VRAM during decoding, and want to skip the default behavior of attempting normal decoding.
- Use the largest tile size that the model and VRAM can handle to reduce the number of tiles needed.
- Disable force_uniform_tiles to only denoise what will be visible after pasting back the tile. This can save processing time, but the model used may not be trained for the resulting tile sizes, and the model will be missing the context around the tile that may otherwise be available with this option enabled.
6. **Important Notes**
- The seam fix step significantly increases processing time. If seams are a problem, it may be better to reduce the denoise or increase tile size instead to avoid the increase in processing time.
+106
View File
@@ -0,0 +1,106 @@
`Ultimate SD Upscale (Custom Sample)` combines image upscaling with tiled image-to-image processing using custom samplers and sigmas for advanced control over the sampling process.
This variant of the Ultimate SD Upscale node is designed for advanced users who want to use custom samplers and sigma schedules instead of the built-in ComfyUI samplers. This allows for more experimental and fine-tuned control over the sampling process during the tiled redraw and seam fix steps. The upscale model is optional; if not provided, the Lanczos algorithm will be used instead.
An image is supplied for upscaling, determined by the upscale_by parameter. The upscale is performed using the upscale model input if provided, otherwise a Lanczos scaling is applied.
After the upscaling, the image goes through the redraw step if the tiling order is not set to "None". A tile is selected from the image, defined by the tiling order and tile parameters from the node widgets. The tile is used as input for an image-to-image process, using the sampling-related parameters given by the node widgets, including custom sampler and sigmas if provided. The tile is then pasted back onto the upscaled image at the appropriate position. This continues until all tiles have been processed.
After the redraw step, the seam fix step is applied if enabled. There are various strategies for fixing seams, defined by the seam_fix_mode parameter from the node widgets. The seam fix step uses the same image-to-image process as the redraw step, but applied to areas between tiles from the redraw step.
## Inputs
### Required Inputs
| Parameter | Data Type | Input Method | Default | Range | Description |
|-----------|-----------|--------------|---------|--------|-------------|
| image | IMAGE | Image Input | None | - | The image to upscale. |
| model | MODEL | Model Selection | None | - | The model to use for image-to-image processing on each tile. |
| positive | CONDITIONING | Conditioning Input | None | - | The positive conditioning for each tile during the redraw step. |
| negative | CONDITIONING | Conditioning Input | None | - | The negative conditioning for each tile during the redraw step. |
| vae | VAE | Model Selection | None | - | The VAE model to use for encoding and decoding tiles. |
| upscale_by | FLOAT | Slider | 2.0 | 0.05-4.0 (step 0.05) | The factor to multiply the height and width of the input image(s) by. |
| seed | INT | Number Input | 0 | 0-18446744073709551615 | The seed to use for image-to-image processing, ensuring reproducible results. |
| steps | INT | Number Input | 20 | 1-10000 | The number of sampling steps to use for each tile during the redraw step and seam fix step. |
| cfg | FLOAT | Slider | 8.0 | 0.0-100.0 | The CFG (Classifier Free Guidance) scale to use for each tile. Higher values make the output follow the prompt more closely. The recommended values depend on the model. |
| sampler_name | COMBO | Dropdown | - | Available samplers | The sampler to use for each tile during the image-to-image process. |
| scheduler | COMBO | Dropdown | - | Available schedulers | The scheduler to use for each tile during the sampling process. |
| denoise | FLOAT | Slider | 0.2 | 0.0-1.0 (step 0.01) | The denoising strength to use for each tile. Higher values allow more creative changes, but more chance of seams. |
| mode_type | COMBO | Dropdown | - | Linear, Chess, None | The tiling order to use for the redraw step. Linear processes tiles row by row, Chess uses a checkerboard pattern, and None skips the redraw step. |
| tile_width | INT | Number Input | 512 | 64-8192 (step 8) | The base width of each tile during the redraw step. |
| tile_height | INT | Number Input | 512 | 64-8192 (step 8) | The base height of each tile during the redraw step. |
| mask_blur | INT | Number Input | 8 | 0-64 | The blur radius for the mask applied to tiles, helping blend tiles seamlessly. A higher value means more of the original image is retained near the seams when pasting the refined tiles back on the upscaled image. |
| tile_padding | INT | Number Input | 32 | 0-8192 (step 8) | The padding to apply to tiles, providing more context for better blending. Adds to tile size (e.g. (tile_width + tile_padding)x(tile_height + tile_padding)). |
| seam_fix_mode | COMBO | Dropdown | - | None, Band Pass, Half Tile, Half Tile + Intersections | The seam fix mode to use. Different modes apply different strategies to fix visible seams between tiles. |
| seam_fix_denoise | FLOAT | Slider | 1.0 | 0.0-1.0 (step 0.01) | The denoising strength to use for the seam fix step. |
| seam_fix_width | INT | Number Input | 64 | 0-8192 (step 8) | The width of the bands used for the Band Pass seam fix mode. |
| seam_fix_mask_blur | INT | Number Input | 8 | 0-64 | The blur radius for the seam fix mask, ensuring smooth blending. |
| seam_fix_padding | INT | Number Input | 16 | 0-8192 (step 8) | The padding to apply for the seam fix step. Adds to tile size. |
| force_uniform_tiles | BOOLEAN | Toggle | True | True/False | If enabled, tiles that would be cut off by the edges of the image will expand using context around the tile to keep the same tile size determined by `tile_width`, `tile_height`, and `tile_padding`. This is what happens in the A1111 Web UI. If disabled, the minimal size for tiles will be used, which may make the sampling faster but may cause artifacts due to irregular tile sizes. |
| tiled_decode | BOOLEAN | Toggle | False | True/False | Whether to use tiled decoding when decoding tiles. Useful when you know the ComfyUI engine will attempt a normal decode and run into an Out Of Memory error, and resorts to tiled decoding anyway. |
### Optional Inputs
| Parameter | Data Type | Input Method | Default | Description |
|-----------|-----------|--------------|---------|-------------|
| upscale_model | UPSCALE_MODEL | Model Selection | None | The upscaler model for upscaling the image before the tiled redraw step. If not provided, the Lanczos algorithm will be used instead. |
| custom_sampler | SAMPLER | Sampler Input | None | A custom sampler to use instead of the built-in ComfyUI sampler specified by sampler_name. Only used if both custom_sampler and custom_sigmas are provided. |
| custom_sigmas | SIGMAS | Sigmas Input | None | A custom noise schedule to use during sampling. Only used if both custom_sampler and custom_sigmas are provided. |
## Outputs
| Output Name | Data Type | Description |
|-------------|-----------|-------------|
| IMAGE | IMAGE | The final upscaled image. |
## Usage Tips
1. **When to Use This Node**
- You want to experiment with custom samplers not available in the standard node.
- You need precise control over sigma schedules.
- You're working with advanced sampling techniques or research implementations.
- You want the flexibility to skip the upscale model and use Lanczos instead.
- You're combining USDU with custom sampling workflows.
2. **Basic Usage**
- Typical tile sizes are based on the model resolutions that it is trained on, such as 512x512 for SD1.5 models. If you can generate a coherent image at that resolution, then it is probably a good choice for the tile size.
- If the workflow involves generating a base image, then using USDU to upscale and refine, it is common to take the base image size as the tile size for the USDU node. For example, generating a 512x512 image, then using USDU with 2x upscale and 512x512 tiles to get a final 1024x1024 image.
3. **Custom Sampler Usage**
- When both custom_sampler and custom_sigmas are provided, custom_sampler will be used instead of the sampler_name parameter
- Custom samplers can implement experimental or specialized sampling algorithms
- Ensure your custom sampler is compatible with the model and VAE being used
- Custom samplers typically require custom_sigmas to be provided as well
4. **Custom Sigmas Usage**
- When both custom_sampler and custom_sigmas are provided, custom_sigmas will be used instead of the default noise schedule.
- Sigma schedules control the noise levels during the denoising process
- Custom sigmas allow you to fine-tune the denoising trajectory
- Different sigma schedules can produce different aesthetic results
- When using custom_sigmas, ensure they're appropriate for your steps parameter
5. **Tiling Modes**
- **Linear**: Processes tiles sequentially row by row.
- **Chess**: Uses a checkerboard pattern, processing every other tile first. Can help reduce visible seams.
- **None**: Skips the redraw step entirely, only performs the initial upscale. Useful if you have an image upscaled by USDU and see seams, and only want to use the seam fix step.
6. **Denoise Settings**
- Use a lower denoise (0.05-0.2) to refine the upscaled image to be less blurry, while avoiding seams and hallucinations.
- Higher denoise values are only usable when using something like a ControlNet tile model to avoid tiles and seams.
7. **Seam Fix Modes**
- **None**: No seam fixing applied
- **Band Pass**: Applies processing to band-like areas between tiles
- **Half Tile**: Processes half-tile overlapping regions
- **Half Tile + Intersections**: Most thorough, processes half-tiles and their intersections
8. **Performance Optimization**
- Enable `tiled_decode` if you're running out of VRAM during decoding, and want to skip the default behavior of attempting normal decoding.
- Use the largest tile size that the model and VRAM can handle to reduce the number of tiles needed.
- Disable force_uniform_tiles to only denoise what will be visible after pasting back the tile. This can save processing time, but the model used may not be trained for the resulting tile sizes, and the model will be missing the context around the tile that may otherwise be available with this option enabled.
9. **Important Notes**
- When no upscale_model is provided, Lanczos is used to scale by the upscale_by factor instead.
- Custom sampler and sigmas should be compatible with each other, and also the model being used.
- custom_sampler and custom_sigmas are both optional, but must be provided together to take effect.
- The seam fix step significantly increases processing time. If seams are a problem, it may be better to reduce the denoise or increase tile size instead to avoid the increase in processing time.
+77
View File
@@ -0,0 +1,77 @@
`Ultimate SD Upscale (No Upscale)` applies tiled image-to-image processing to an already upscaled image to enhance details and fix seams, without performing the initial upscaling step with an upscale model.
This variant of the Ultimate SD Upscale node is designed for situations where you already have an upscaled image and only want to apply the tiled redraw and seam fix steps. This is useful when you've upscaled an image using a different method or upscaler and want to use USDU's tiled refinement capabilities to add details and remove artifacts.
The image goes through the redraw step if the tiling order is not set to "None". A tile is selected from the image, defined by the tiling order and tile parameters from the node widgets. The tile is used as input for an image-to-image process, using the sampling-related parameters given by the node widgets. The tile is then pasted back onto the image at the appropriate position. This continues until all tiles have been processed.
After the redraw step, the seam fix step is applied if enabled. There are various strategies for fixing seams, defined by the seam_fix_mode parameter from the node widgets. The seam fix step uses the same image-to-image process as the redraw step, but applied to areas between tiles from the redraw step.
## Inputs
| Parameter | Data Type | Input Method | Default | Range | Description |
|-----------|-----------|--------------|---------|--------|-------------|
| upscaled_image | IMAGE | Image Input | None | - | The already upscaled image to refine with tiled processing. |
| model | MODEL | Model Selection | None | - | The model to use for image-to-image processing on each tile. |
| positive | CONDITIONING | Conditioning Input | None | - | The positive conditioning for each tile during the redraw step. |
| negative | CONDITIONING | Conditioning Input | None | - | The negative conditioning for each tile during the redraw step. |
| vae | VAE | Model Selection | None | - | The VAE model to use for encoding and decoding tiles. |
| seed | INT | Number Input | 0 | 0-18446744073709551615 | The seed to use for image-to-image processing, ensuring reproducible results. |
| steps | INT | Number Input | 20 | 1-10000 | The number of sampling steps to use for each tile during the redraw step and seam fix step. |
| cfg | FLOAT | Slider | 8.0 | 0.0-100.0 | The CFG (Classifier Free Guidance) scale to use for each tile. Higher values make the output follow the prompt more closely. The recommended values depend on the model. |
| sampler_name | COMBO | Dropdown | - | Available samplers | The sampler to use for each tile during the image-to-image process. |
| scheduler | COMBO | Dropdown | - | Available schedulers | The scheduler to use for each tile during the sampling process. |
| denoise | FLOAT | Slider | 0.2 | 0.0-1.0 (step 0.01) | The denoising strength to use for each tile. Higher values allow more creative changes, but more chance of seams. |
| mode_type | COMBO | Dropdown | - | Linear, Chess, None | The tiling order to use for the redraw step. Linear processes tiles row by row, Chess uses a checkerboard pattern, and None skips the redraw step. |
| tile_width | INT | Number Input | 512 | 64-8192 (step 8) | The base width of each tile during the redraw step. |
| tile_height | INT | Number Input | 512 | 64-8192 (step 8) | The base height of each tile during the redraw step. |
| mask_blur | INT | Number Input | 8 | 0-64 | The blur radius for the mask applied to tiles, helping blend tiles seamlessly. A higher value means more of the original image is retained near the seams when pasting the refined tiles back on the upscaled image. |
| tile_padding | INT | Number Input | 32 | 0-8192 (step 8) | The padding to apply to tiles, providing more context for better blending. Adds to tile size (e.g. (tile_width + tile_padding)x(tile_height + tile_padding)). |
| seam_fix_mode | COMBO | Dropdown | - | None, Band Pass, Half Tile, Half Tile + Intersections | The seam fix mode to use. Different modes apply different strategies to fix visible seams between tiles. |
| seam_fix_denoise | FLOAT | Slider | 1.0 | 0.0-1.0 (step 0.01) | The denoising strength to use for the seam fix step. |
| seam_fix_width | INT | Number Input | 64 | 0-8192 (step 8) | The width of the bands used for the Band Pass seam fix mode. |
| seam_fix_mask_blur | INT | Number Input | 8 | 0-64 | The blur radius for the seam fix mask, ensuring smooth blending. |
| seam_fix_padding | INT | Number Input | 16 | 0-8192 (step 8) | The padding to apply for the seam fix step. Adds to tile size. |
| force_uniform_tiles | BOOLEAN | Toggle | True | True/False | If enabled, tiles that would be cut off by the edges of the image will expand using context around the tile to keep the same tile size determined by `tile_width`, `tile_height`, and `tile_padding`. This is what happens in the A1111 Web UI. If disabled, the minimal size for tiles will be used, which may make the sampling faster but may cause artifacts due to irregular tile sizes. |
| tiled_decode | BOOLEAN | Toggle | False | True/False | Whether to use tiled decoding when decoding tiles. Useful when you know the ComfyUI engine will attempt a normal decode and run into an Out Of Memory error, and resorts to tiled decoding anyway. |
## Outputs
| Output Name | Data Type | Description |
|-------------|-----------|-------------|
| IMAGE | IMAGE | The final refined image. |
## Usage Tips
1. **When to Use This Node**
- You've already upscaled an image with a different upscaler and want to add details.
- You want to fix seams or artifacts in an existing high-resolution image.
- You want more control by separating the upscaling and refinement steps.
- You want to skip the use of an upscale model, and do a simple upscale with an algorithm like Lanczos or Nearest Neighbor beforehand.
2. **Basic Usage**
- Typical tile sizes are based on the model resolutions that it is trained on, such as 512x512 for SD1.5 models. If you can generate a coherent image at that resolution, then it is probably a good choice for the tile size.
3. **Tiling Modes**
- **Linear**: Processes tiles sequentially row by row.
- **Chess**: Uses a checkerboard pattern, processing every other tile first. Can help reduce visible seams.
- **None**: Skips the redraw step entirely. Useful if you only want to use the seam fix step to fix visible seams without adding new details.
4. **Denoise Settings**
- Use a lower denoise (0.05-0.2) to refine the upscaled image to be less blurry, while avoiding seams and hallucinations.
- Higher denoise values are only usable when using something like a ControlNet tile model to avoid tiles and seams.
5. **Seam Fix Modes**
- **None**: No seam fixing applied
- **Band Pass**: Applies processing to band-like areas between tiles
- **Half Tile**: Processes half-tile overlapping regions
- **Half Tile + Intersections**: Most thorough, processes half-tiles and their intersections
6. **Performance Optimization**
- Enable `tiled_decode` if you're running out of VRAM during decoding, and want to skip the default behavior of attempting normal decoding.
- Use the largest tile size that the model and VRAM can handle to reduce the number of tiles needed.
- Disable force_uniform_tiles to only denoise what will be visible after pasting back the tile. This can save processing time, but the model used may not be trained for the resulting tile sizes, and the model will be missing the context around the tile that may otherwise be available with this option enabled.
7. **Important Notes**
- This node does not perform any upscaling; it expects an already upscaled image as input
- The input image size determines the output size (no scaling is applied)
- The seam fix step significantly increases processing time. If seams are a problem, it may be better to reduce the denoise or increase tile size instead to avoid the increase in processing time.
+35 -28
View File
@@ -27,35 +27,35 @@ SEAM_FIX_MODES = {
def USDU_base_inputs():
required = [
("image", ("IMAGE",)),
("image", ("IMAGE", {"tooltip": "The image to upscale."})),
# Sampling Params
("model", ("MODEL",)),
("positive", ("CONDITIONING",)),
("negative", ("CONDITIONING",)),
("vae", ("VAE",)),
("upscale_by", ("FLOAT", {"default": 2, "min": 0.05, "max": 4, "step": 0.05})),
("seed", ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff})),
("steps", ("INT", {"default": 20, "min": 1, "max": 10000, "step": 1})),
("cfg", ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0})),
("sampler_name", (comfy.samplers.KSampler.SAMPLERS,)),
("scheduler", (comfy.samplers.KSampler.SCHEDULERS,)),
("denoise", ("FLOAT", {"default": 0.2, "min": 0.0, "max": 1.0, "step": 0.01})),
("model", ("MODEL", {"tooltip": "The model to use for image-to-image."})),
("positive", ("CONDITIONING", {"tooltip": "The positive conditioning for each tile."})),
("negative", ("CONDITIONING", {"tooltip": "The negative conditioning for each tile."})),
("vae", ("VAE", {"tooltip": "The VAE model to use for tiles."})),
("upscale_by", ("FLOAT", {"default": 2, "min": 0.05, "max": 4, "step": 0.05, "tooltip": "The factor to upscale the image by."})),
("seed", ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "tooltip": "The seed to use for image-to-image."})),
("steps", ("INT", {"default": 20, "min": 1, "max": 10000, "step": 1, "tooltip": "The number of steps to use for each tile."})),
("cfg", ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0, "tooltip": "The CFG scale to use for each tile."})),
("sampler_name", (comfy.samplers.KSampler.SAMPLERS, {"tooltip": "The sampler to use for each tile."})),
("scheduler", (comfy.samplers.KSampler.SCHEDULERS, {"tooltip": "The scheduler to use for each tile."})),
("denoise", ("FLOAT", {"default": 0.2, "min": 0.0, "max": 1.0, "step": 0.01, "tooltip": "The denoising strength to use for each tile."})),
# Upscale Params
("upscale_model", ("UPSCALE_MODEL",)),
("mode_type", (list(MODES.keys()),)),
("tile_width", ("INT", {"default": 512, "min": 64, "max": MAX_RESOLUTION, "step": 8})),
("tile_height", ("INT", {"default": 512, "min": 64, "max": MAX_RESOLUTION, "step": 8})),
("mask_blur", ("INT", {"default": 8, "min": 0, "max": 64, "step": 1})),
("tile_padding", ("INT", {"default": 32, "min": 0, "max": MAX_RESOLUTION, "step": 8})),
("upscale_model", ("UPSCALE_MODEL", {"tooltip": "The upscaler model for upscaling the image."})),
("mode_type", (list(MODES.keys()), {"tooltip": "The tiling order to use for the redraw step."})),
("tile_width", ("INT", {"default": 512, "min": 64, "max": MAX_RESOLUTION, "step": 8, "tooltip": "The width of each tile."})),
("tile_height", ("INT", {"default": 512, "min": 64, "max": MAX_RESOLUTION, "step": 8, "tooltip": "The height of each tile."})),
("mask_blur", ("INT", {"default": 8, "min": 0, "max": 64, "step": 1, "tooltip": "The blur radius for the mask."})),
("tile_padding", ("INT", {"default": 32, "min": 0, "max": MAX_RESOLUTION, "step": 8, "tooltip": "The padding to apply between tiles."})),
# Seam fix params
("seam_fix_mode", (list(SEAM_FIX_MODES.keys()),)),
("seam_fix_denoise", ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01})),
("seam_fix_width", ("INT", {"default": 64, "min": 0, "max": MAX_RESOLUTION, "step": 8})),
("seam_fix_mask_blur", ("INT", {"default": 8, "min": 0, "max": 64, "step": 1})),
("seam_fix_padding", ("INT", {"default": 16, "min": 0, "max": MAX_RESOLUTION, "step": 8})),
("seam_fix_mode", (list(SEAM_FIX_MODES.keys()), {"tooltip": "The seam fix mode to use."})),
("seam_fix_denoise", ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01, "tooltip": "The denoising strength to use for the seam fix."})),
("seam_fix_width", ("INT", {"default": 64, "min": 0, "max": MAX_RESOLUTION, "step": 8, "tooltip": "The width of the seam fix area."})),
("seam_fix_mask_blur", ("INT", {"default": 8, "min": 0, "max": 64, "step": 1, "tooltip": "The blur radius for the seam fix mask."})),
("seam_fix_padding", ("INT", {"default": 16, "min": 0, "max": MAX_RESOLUTION, "step": 8, "tooltip": "The padding to apply for the seam fix."})),
# Misc
("force_uniform_tiles", ("BOOLEAN", {"default": True})),
("tiled_decode", ("BOOLEAN", {"default": False})),
("force_uniform_tiles", ("BOOLEAN", {"default": True, "tooltip": "Force all tiles to be the same as the set tile size, even when tiles could be smaller. This can help prevent the model from working with irregular tile sizes."})),
("tiled_decode", ("BOOLEAN", {"default": False, "tooltip": "Whether to use tiled decoding when decoding tiles."})),
]
optional = []
@@ -98,7 +98,10 @@ class UltimateSDUpscale:
RETURN_TYPES = ("IMAGE",)
FUNCTION = "upscale"
CATEGORY = "image/upscaling"
OUTPUT_TOOLTIPS = ("The final upscaled image.",)
DESCRIPTION = "Upscales an image and runs image-to-image on tiles from the input image."
def upscale(self, image, model, positive, negative, vae, upscale_by, seed,
steps, cfg, sampler_name, scheduler, denoise, upscale_model,
@@ -178,6 +181,8 @@ class UltimateSDUpscaleNoUpscale(UltimateSDUpscale):
RETURN_TYPES = ("IMAGE",)
FUNCTION = "upscale"
CATEGORY = "image/upscaling"
OUTPUT_TOOLTIPS = ("The final refined image.",)
DESCRIPTION = "Runs image-to-image on tiles from the input image."
def upscale(self, upscaled_image, model, positive, negative, vae, seed,
steps, cfg, sampler_name, scheduler, denoise,
@@ -196,14 +201,16 @@ class UltimateSDUpscaleCustomSample(UltimateSDUpscale):
def INPUT_TYPES(s):
required, optional = USDU_base_inputs()
remove_input(required, "upscale_model")
optional.append(("upscale_model", ("UPSCALE_MODEL",)))
optional.append(("custom_sampler", ("SAMPLER",)))
optional.append(("custom_sigmas", ("SIGMAS",)))
optional.append(("upscale_model", ("UPSCALE_MODEL", {"tooltip": "The model to use for upscaling the image. If not provided, a simple Lanczos scaling will be used instead."})))
optional.append(("custom_sampler", ("SAMPLER", {"tooltip": "A custom sampler to use instead of the built-in ComfyUI sampler specified by sampler_name. Only used if both custom_sampler and custom_sigmas are provided."})))
optional.append(("custom_sigmas", ("SIGMAS", {"tooltip": "A custom noise schedule to use during sampling. Only used if both custom_sampler and custom_sigmas are provided."})))
return prepare_inputs(required, optional)
RETURN_TYPES = ("IMAGE",)
FUNCTION = "upscale"
CATEGORY = "image/upscaling"
OUTPUT_TOOLTIPS = ("The final upscaled image.",)
DESCRIPTION = "Runs image-to-image on tiles from the input image."
def upscale(self, image, model, positive, negative, vae, upscale_by, seed,
steps, cfg, sampler_name, scheduler, denoise,