comfyui-auto-size
ComfyUI plugin providing auto-sized image and latent nodes with model-aligned resolutions.
ComfyUI Auto Size
A ComfyUI custom node for handling image resolutions with smart, model-aware presets for 2026 diffusion models.
🌟 Supported Models
| Model | Use Case | Resolution Multiple | Source | |-------|----------|---------------------|--------| | Qwen-Image | Text-image-to-image | 28px | Official docs | | Illustrious | Anime | 32px | Community standard | | Z-Image | Text-image-to-image | 32px | Official docs | | Flux2-Klein/Flux | Text-image-to-image | 32px | Similar to Z-Image/Illustrious |
✨ Features
- Dynamic Dropdowns: Size dropdown filters to show only relevant presets for your selected model
- Model-Aware Snapping: Automatically rounds resolutions to required multiples (28px or 32px)
- Robust Resizing: Multiple resize modes—
Center Crop,Scale to Fit,Stretch to Fill
📦 Nodes
Auto Size Latent
Category: latent/AutoSize
Generates an empty latent tensor at a model-aligned resolution.
| Input | Description |
|-------|-------------|
| model | Target model (qwen-image, z-image, flux, illustrious) |
| size | Preset or "Full Custom" |
| custom_longer_size | Longer side in pixels (set to 0 to use preset) |
| custom_ratio | Aspect ratio for custom mode |
| batch_size | Number of latents |
Outputs: latent, width, height, size
Auto Size (Image/Mask)
Category: image/AutoSize
Resizes an existing image and/or mask to target dimensions.
| Input | Description |
|-------|-------------|
| crop_method | Center Crop, Top-Left Crop, Scale to Fit, Stretch to Fill |
| scale_method | lanczos, bicubic, bilinear, nearest |
| image | Optional input image |
| mask | Optional input mask |
Outputs: image, mask, width, height, size
🛠️ Installation
cd ComfyUI/custom_nodes
git clone https://github.com/jluo-github/comfyui-auto-size.git
Restart ComfyUI and reload the browser.
⚙️ Resolution Logic
- Custom Override (
custom_longer_size > 0): Calculates resolution from longer side + ratio, snapped to model's multiple - Preset Mode (
custom_longer_size = 0): Uses the Size dropdown value directly
� Project Structure
nodes/ ComfyUI node definitions
utils/ Core logic (presets, resizing)
js/ Dynamic dropdown behavior
tests/ Unit tests
License
Made with ❤️ for the ComfyUI community