Skip to content

marhensa/sdxl-recommended-res-calc

Repository files navigation

sdxl-recommended-res-calc

It's also available to install it via ComfyUI Manager (Search: Recommended Resolution Calculator)

A simple script (also a Custom Node in ComfyUI thanks to CapsAdmin), to calculate and automatically set the recommended initial latent size for SDXL image generation and its Upscale Factor based on the desired Final Resolution output.

According to SDXL paper references (Page 17), it's advised to avoid arbitrary resolutions and stick to those initial resolution, as SDXL was trained using those specific resolution.

TL;DR : Basicaly, you are typing your desired target FINAL resolution, it will gives you :

  1. what resolution you should use according to SDXL suggestion as initial input resolution
  2. how much upscale it needs to get that final resolution (both normal upscaler or upscaler value that have been 4x scaled by upscale model)

Usage Showcase In ComfyUI

image

Example Workflow of usage in ComfyUI : JSON / PNG

To install it as ComfyUI custom node using ComfyUI Manager (Easy Way)

  1. Make sure you already have ComfyUI Manager (it's like an extension manager)
  2. Search for: Recommended Resolution Calculator
  3. Install it
  4. Restart ComfyUI, now this custom node "Recommended Resolution Calculator" is located in "utils" node section
  5. Usage: DesiredXSIZE and DesiredYSIZE is your TARGET FINAL RESOLUTION, Upscale Factor OR Reverse Upscale Factor is used as example above

To install it as ComfyUI custom node using manual Git Clone Operation :

  1. Go to this folder /ComfyUI/custom_nodes/
  2. Open command prompt to that folder, type this line below:
  3. git clone https://github.com/marhensa/sdxl-recommended-res-calc.git
  4. Restart ComfyUI, now this custom node "Recommended Resolution Calculator" is located in "utils" node section
  5. Usage: DesiredXSIZE and DesiredYSIZE is your TARGET FINAL RESOLUTION, Upscale Factor OR Reverse Upscale Factor is used as example above

As standalone (Not Using ComfyUI):

  1. Download (Click green button Code > Download ZIP) from repo. Or this direct link.
  2. Make sure .Py and .Bat file on same folder
  3. Double click .Bat file! (.Sh for Linux)
  4. Input your desired Final Resolution
  5. You'll get recommended SDXL Initial Image Size, and its upscale factor to reach the Final Resolution.

Usage Showcase As Standalone

Screenshot 2023-08-19 173513 Screenshot 2023-08-19 173615 Screenshot 2023-08-19 173523

References SDXL Paper: https://arxiv.org/abs/2307.01952 | https://arxiv.org/pdf/2307.01952.pdf | Page 17

About

A simple script to calculate the recommended initial latent size for SDXL image generation and its Upscale Factor based on the desired Final Resolution output

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages