sdxl-recommended-res-calc

sdxl-recommended-res-calc
★ 92

分辨率计算SDXLUpscale因子初始latent尺寸
根据目标最终输出分辨率,自动计算并设置SDXL推荐初始latent尺寸/纵横比和Upscale Factor,支持正反向2x/4x,避免随意选分辨率
💡 根据目标分辨率自动计算并设置初始尺寸与放大因子
🍴 6 Forks💻 Python🔄 2025-04-13
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/b45acaa3411d
image
Screenshot 2023-08-19 173513
Screenshot 2023-08-19 173615
Screenshot 2023-08-19 173523
📄 README

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 :

  • what resolution you should use according to SDXL suggestion as initial input resolution
  • 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

    Example Workflow of usage in ComfyUI : JSON / PNG

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

  • Make sure you already have ComfyUI Manager (it’s like an extension manager)
  • Search for: Recommended Resolution Calculator
  • Install it
  • Restart ComfyUI, now this custom node “Recommended Resolution Calculator” is located in “utils” node section
  • 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 :

  • Go to this folder /ComfyUI/custom_nodes/
  • Open command prompt to that folder, type this line below:
  • git clone https://github.com/marhensa/sdxl-recommended-res-calc.git
  • Restart ComfyUI, now this custom node “Recommended Resolution Calculator” is located in “utils” node section
  • 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):

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

    References

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