ResolutionMaster is a powerful ComfyUI custom node for precise resolution and aspect ratio control in AI image generation workflows. It provides an intuitive interface with advanced scaling options, preset management, latent output, and model-specific optimizations.
🔹 Quick Start
|
ShowTimeResolutionMaster_v4.mp4
ShowTimeResolutionMaster_ResolutionManager_v2.mp4
- Interactive 2D Canvas Control: Visually select resolution with real-time preview
- Normal Drag: Standard behavior with snap to canvas grid (controlled by
canvas_step_x/y) - Shift + Drag: Preserves aspect ratio while dragging (with snap enabled)
- Ctrl + Drag: Disables snap for fine-tuning without grid constraints
- Ctrl + Shift + Drag: Preserves aspect ratio with 1px precision (no snap)
- Normal Drag: Standard behavior with snap to canvas grid (controlled by
- Smart Rescaling: Automatic calculation of rescale factors for upscaling workflows
- Snap Button: Round current dimensions to the snap value (NOT related to 2D canvas grid)
- Real-time Info Display: Shows current resolution, megapixels, p-value and aspect ratio
- Visual Output Values: Color-coded clickable values at output slots (blue/pink/green)
- Manual Scale: Direct multiplier control (ex. 2.0x)
- Resolution Targeting: Scale to standard resolutions (ex. 480p, 720p, 1080p, 2160p)
- Megapixel Targeting: Scale to specific megapixel counts (ex. 5 MP)
- Live Preview: See resulting dimensions before applying changes
Extensive preset library organized by use case:
- Standard: Common aspect ratios (1:1, 4:3, 16:9, 21:9, etc.)
- SDXL: Optimized resolutions for Stable Diffusion XL
- Flux: Flux model optimized presets with smart constraints
- Flux.2: Flux.2 optimized presets with 128-channel latent support
- WAN: Video model presets with resolution recommendations
- HiDream Dev: HiDream model optimized presets
- Qwen-Image: Qwen-Image model optimized presets
- Social Media: Instagram, Twitter, Facebook, YouTube optimized sizes
- Print: Standard print formats (A4, Letter, photo sizes)
- Cinema: Professional film aspect ratios (2.39:1, 1.85:1, etc.)
- Display Resolutions: Standard screen/video resolutions (720p, 1080p, 4K, 8K, etc.)
| Mode | Best For | Optimization Rules |
|---|---|---|
| SDXL | Stable Diffusion XL generation | Enforces officially supported fixed resolutions for optimal generation quality |
| Flux | Flux image workflows | Uses 32px increments, keeps dimensions between 320px and 2560px, and limits output to 4.0 MP |
| Flux.2 | Flux.2 workflows | Uses Flux.2-specific preset matching and supports the latent_128x16 latent type |
| WAN | Video generation | Supports 320p to 820p, uses 16px increments, keeps video-friendly ratios, and recommends 480p or 720p |
| HiDream Dev | HiDream preset matching | Finds the closest HiDream Dev preset by dimensions and aspect ratio, including flipped orientations |
| Qwen-Image | Qwen-Image workflows | Keeps images in the ~0.6 MP to 4.2 MP range, preserving valid inputs and scaling out-of-range inputs |
- Search
Comfyui-Resolution-Masterin ComfyUI-Manager and clickInstallbutton. - Restart ComfyUI.
- Install ComfyUi. I use portable version.
- Clone this repo into
custom_modules:cd ComfyUI/custom_nodes/ git clone https://github.com/Azornes/Comfyui-Resolution-Master.git - Start up ComfyUI.
- Add the "Resolution Master" node to your workflow
- Connect the outputs to your image generation nodes:
width: Current width value (click the blue number to set custom width)height: Current height value (click the pink number to set custom height)rescale_factor: Calculated scale factor for upscaling (green number)
If you want to resize an input image using Resolution Master:
- Load Image: Add a "Load Image" node and connect your image.
- Connect to Resolution Master: Link the image output to the input of Resolution Master (enables Auto-Detect).
- Configure Resolution Master:
- Enable Auto-Detect toggle to read input image dimensions.
- Select a preset or set target resolution/aspect ratio.
- Use Auto-Fit or Auto-Resize for automatic adaptation.
- Resize Image: Connect Resolution Master's
widthandheightoutputs to a "Resize Image" node's width/height inputs. - Connect Image: Link the original image from "Load Image" to the "Resize Image" node's image input.
- Output: The resized image will match your target specifications.
Note: Resolution Master doesn't process images directly—it calculates dimensions. Always connect it to a resizing node (like "Resize Image") for actual image transformation.
For new image generation:
- Connect Resolution Master's
width/heightto your sampler/checkpoint nodes. - Use
rescale_factorwith upscaling nodes if needed. - Enable Auto-Detect if using an input image as reference.
- ⇄ Swap Button: Swaps width and height values
- ⊞ Snap Button: Rounds the current width/height to the nearest snap value (e.g., if snap=64 and width=520, clicking Snap makes it 512)
- Snap Value Slider: Sets the value used by the Snap button (16-256px). Important: This does NOT change the 2D canvas grid behavior!
- White Dot: Drag to set resolution visually
- Grid Dots: Visual guides controlled by
canvas_step_x/yproperties (NOT by the snap slider) - Blue Rectangle: Shows current resolution selection
- ⬆ Manual Scale Button: Applies the manual scale factor to current dimensions
- 📺 Resolution Button: Scales to target resolution (e.g., 1080p)
- 📷 Megapixels Button: Scales to target megapixel count
- Prioritize Ratio Checkbox: Preserves the current aspect ratio as the top priority when applying scaling. The final dimensions may be slightly above or below the selected scale, p-value, or megapixel target.
- Radio Buttons: Select which scaling mode affects the
rescale_factoroutput
- Auto-detect Toggle: ON/OFF switch for automatic dimension detection from connected images
- Monitors input connection every second
- Updates dimensions when new image is detected
- Shows detected resolution in green text
- Auto-Detect buttons can be clicked manually. The checkbox beside each button enables that same action automatically for newly detected images.
- 🎯 Auto-fit Button: Finds best matching preset for current dimensions
- Analyzes both aspect ratio and total pixels
- Checks both normal and flipped orientations
- Applies category-specific scaling when Custom Calc is enabled
- Fit Checkbox: Automatically run Fit when dimensions change
- Located next to the Fit button
- Only active when category is selected and image detected
- 📐 Auto-Resize Button: Applies scaling based on selected mode (Manual/Resolution/Megapixels)
- Integrates with active scaling mode from Scaling section
- Maintains manual scale value without reset to 1.0x
- Resize Checkbox: Automatically apply scaling when new image is detected
- Works in sequence after Auto-fit (if enabled)
- Applies chosen scaling mode to detected dimensions
- Auto-Snap Button: Snaps current dimensions to the configured snap value
- Uses the same snap logic as the Snap button in the Actions section
- Prevents dimensions from snapping down to 0; small dimensions snap up to at least one snap step
- Snap Checkbox: Automatically snap dimensions after Resize when a new image is detected
- Runs in sequence after Auto-Fit and Auto-Resize
- Useful for keeping detected or resized dimensions aligned to model-friendly multiples
- Detected Text (green): Click to apply the detected image's original dimensions
- ⚡ Auto-calc Button: Applies model-specific calculations to current dimensions
- Calc Checkbox: Automatically applies model-specific optimizations after Fit, Resize, and Snap
- Show Toggle: Shows or hides the orange Calc information panel without changing Auto-Calc behavior
- Category Dropdown: Select preset category (Standard, SDXL, Flux, etc.)
- Preset Dropdown: Choose specific preset from selected category
You can customize various parameters by accessing the node's Properties panel in ComfyUI. Here's a complete list of all configurable properties:
canvas_min_x/canvas_min_y: Minimum values for X and Y axes (default: 0)canvas_max_x/canvas_max_y: Maximum values for X and Y axes (default: 2048, max: 32768)- Increase these for working with higher resolutions (e.g., 8192 for 8K)
canvas_step_x/canvas_step_y: Grid snap increments for the 2D canvas (default: 64)- This controls the grid dots and snap behavior when dragging on the 2D canvas
- NOT controlled by the snap slider in the Actions section
canvas_decimals_x/canvas_decimals_y: Decimal precision for X/Y values (default: 0)canvas_snap: Enable/disable grid snapping on 2D canvas (default: true)canvas_dots: Show/hide grid dots on 2D canvas (default: true)canvas_frame: Show/hide the blue selection frame (default: true)
action_slider_snap_min: Minimum value for snap slider (default: 16)action_slider_snap_max: Maximum value for snap slider (default: 256)action_slider_snap_step: Step increment for snap slider (default: 16)
scaling_slider_min: Minimum manual scale factor (default: 0.1)scaling_slider_max: Maximum manual scale factor (default: 4.0)scaling_slider_step: Step increment for scale slider (default: 0.1)megapixels_slider_min: Minimum megapixels target (default: 0.5)megapixels_slider_max: Maximum megapixels target (default: 6.0)megapixels_slider_step: Step increment for megapixels slider (default: 0.1)
section_extraControls_collapsed: Canvas Only mode state. When enabled, all extra control sections below the 2D canvas are hidden (default: false)- Toggle it with the compact button in the top-right corner of the node title bar.
section_actions_collapsed: Actions section collapsed state (default: false)section_scaling_collapsed: Scaling section collapsed state (default: false)section_autoDetect_collapsed: Auto-Detect section collapsed state (default: false)section_presets_collapsed: Presets section collapsed state (default: false)
- Right-click on the ResolutionMaster node
- Select "Properties"
- Set
canvas_max_xandcanvas_max_yto 8192 - Set
canvas_step_xandcanvas_step_yto 128 for larger grid increments - Set
manual_slider_max_wandmanual_slider_max_hto 8192
- Select a Category: Choose from the dropdown (e.g., "SDXL", "Social Media")
- Choose a Preset: Select specific aspect ratio or resolution
- Enable Custom Calc (optional): Checkbox appears next to preset dropdown
- Activates model-specific constraints
- Automatically adjusts dimensions to model requirements
- Apply: Dimensions are automatically updated
ResolutionMaster includes a powerful Preset Manager system for creating, organizing, and managing custom presets. Access it by clicking the "⚙️ Manage Presets" button in the Presets section.
The main view shows all your custom presets organized by category:
- Statistics Header: Displays total categories and preset count
- Category Sections: Each category shows its presets with dimensions
- Bulk Operations: Select multiple presets for batch deletion (Shift+Click for range selection)
- Empty State: Helpful message when no custom presets exist
Create or modify presets with an intuitive interface:
- Category Selection: Choose target category from dropdown
- Rename Category: Click the ✏️ button next to category name to rename
- Quick Add Form:
- Name field with real-time validation
- Width and Height inputs (minimum 64px)
- Live preview showing aspect ratio and shape visualization
- Visual feedback for edit mode (green accents) vs add mode (blue accents)
- Preset Preview: Grid view of all presets in selected category
- Click any preset to load its values into the form for editing
- Delete custom presets or hide/unhide built-in presets
- Visual indicators for custom (⚙️ icon) and hidden presets
The Preset Manager supports advanced drag & drop with visual feedback:
- Drag Handle (left side): Drag presets to reorder within category or move between categories
- Visual Indicators:
- Blue line: Reordering within same category
- Orange line: Moving to different category
- Red line: Invalid drop (name conflict)
- Green line: Duplicate/clone operation
- Modifier Keys:
- Normal Drag: Move preset to new position
- Drag by Clone Handle (⊕): Duplicate preset to new location
- Drag Category Headers: Reorder entire categories by dragging their headers
- Drop Zones:
- Above any category header
- Below last category (in category section body)
- At top (drop on statistics header)
- Clone Handle (⊕ icon): Drag this handle to duplicate a preset
- Auto-naming: Automatically generates unique names (e.g., "Preset (1)", "Preset (2)")
- Cross-category Cloning: Duplicate presets between different categories
- Smart Positioning: Dropped preset appears at the exact position where you drop it
- Double-click on any preset or category name to rename in-place
- Enter: Save changes
- Escape: Cancel editing
- Auto-validation: Prevents duplicate names, empty names
- Auto-unique naming (categories): Adds suffix "(1)", "(2)" if name exists
- Click ✏️ button next to category name in Add view
- Real-time validation with error messages
- Shows current name for reference
- Enter to apply, Escape to cancel
Advanced users can directly edit the preset configuration as JSON:
- Multiple Editor Modes: Code, Tree, Form, Text, View, Preview
- Syntax Highlighting: VS Code-style dark theme (Twilight)
- Real-time Validation: Instant feedback on JSON syntax errors
- Drag & Drop: Drop .json files directly into the editor to load them
- Full Editing: Add, remove, or modify categories and presets
- Import/Export:
- Apply changes to replace current configuration
- Export current configuration as JSON file
- All Features Available: Sort, transform, search, and more
Access: Click "{ } JSON Editor" button in Preset Manager footer
Use Cases:
- Bulk editing multiple presets
- Importing preset collections from files
- Creating complex preset structures
- Backup and restore configurations
- Sharing preset collections with others
- Individual Delete: Click 🗑️ button on any custom preset
- Hide Built-in Presets: Click 🗑️ on built-in presets to hide them (they remain in system)
- Unhide: Click 🗑️ again on hidden presets to restore visibility
- Bulk Delete:
- Select multiple presets using checkboxes
- Click "Delete Selected" button
- Shift+Click for range selection
- Delete Empty Categories: Option in footer to clean up categories with no presets
- Color-coded Indicators: Different colors for different drag operations
- Interactive Tooltips: Hover over buttons for helpful descriptions
- Mode Indicators: Visual distinction between add and edit modes
- Real-time Validation: Instant feedback on errors and conflicts
- Shape Preview: Visual representation of aspect ratio in add/edit form
- Double-click: Rename preset or category name
- Enter: Apply rename or save changes
- Escape: Cancel current operation or close dialog
- Shift+Click: Select range of presets (bulk operations)
- Ctrl/Cmd+Drag: Fine control for drag operations
- Open Preset Manager
- Click "📥 Export JSON" button
- JSON file downloads with current preset configuration
- Share or backup your custom presets
- Open Preset Manager
- Click "📤 Import JSON" button
- Choose merge or replace mode:
- Merge: Add new presets, keep existing ones
- Replace: Completely replace current configuration
- Select your .json file
- Presets are loaded instantly
Alternative: Use the JSON Editor's drag & drop feature to load preset files directly
- Organize by Category: Keep related presets together for easier management
- Use Descriptive Names: Clear names make presets easier to find and use
- Clone for Variations: Duplicate similar presets and adjust slightly
- Regular Backups: Export your presets periodically
- Hide Unused Built-ins: Declutter your preset list by hiding unused built-in presets
- Keyboard Navigation: Use double-click rename for quick adjustments
- Visual Validation: Watch the preview shape when creating presets to verify aspect ratio
- Drag to Organize: Quickly reorder presets and categories with drag & drop
The node provides three scaling methods that work together:
- Set Base Resolution: Use presets or manual input
- Choose Scaling Method:
- Manual: Direct multiplier
- Resolution: Target specific output resolution
- Megapixels: Target specific pixel count
- Apply Scale: Updates dimensions while maintaining aspect ratio
- Enable Prioritize Ratio when exact aspect ratio should matter more than hitting the scale target exactly. For example, a 3.0 MP target may resolve to 2.99 MP or 3.01 MP if that is the closest exact-ratio result.
- Use Rescale Factor: Connect to upscaling nodes in your workflow
- Snap Button: Rounds dimensions to nearest grid value
- Adjustable Grid: 16px to 256px increments (adjustable via slider)
- Smart Snapping: Respects model constraints when Custom Calc is enabled
- Canvas Drag Modifiers:
- Normal Drag: Standard behavior with snap to grid
- Shift + Drag: Preserves aspect ratio while dragging (with snap enabled)
- Ctrl + Drag: Disables snap for fine-tuning without grid constraints
- Ctrl + Shift + Drag: Preserves aspect ratio with 1px precision (no snap)
The detailed controls are described in Understanding the Controls > Auto-Detect Section. When multiple Auto-Detect checkboxes are enabled, actions run in this order:
- Fit: Match the detected size to the closest preset.
- Resize: Apply the active scaling mode.
- Snap: Round dimensions to the configured snap value.
- Calc: Apply model-specific constraints.
- width (INT): Selected width in pixels
- height (INT): Selected height in pixels
- rescale_factor (FLOAT): Calculated scaling factor for external upscaling nodes
- This value is used when you want to upscale/downscale your image using external nodes
- Changes based on selected scaling mode (manual scale, resolution target, or megapixels target)
- Connect this output to upscaling nodes in your workflow for resolution-independent scaling
- batch_size (INT): Number of latent images in the batch
- Configurable via the batch_size input parameter (default: 1, range: 1-4096)
- Use this when you need to generate multiple images with the same resolution settings
- Connect to nodes that support batch processing
- latent (LATENT): Generated empty latent tensor ready for sampling
- Automatically created based on width, height, batch_size, and latent_type
latent_4x8:[batch_size, 4, height/8, width/8]for SD/SDXL/Flux-style latentslatent_128x16:[batch_size, 128, height/16, width/16]for Flux.2-style latents- Connect directly to KSampler or other sampling nodes
- Eliminates the need for a separate "Empty Latent Image" node
Values are shown directly at output slots for quick reference.
The rescale factor adapts based on your selection (choose via radio buttons):
- Manual Mode: Uses the manual scale slider value (adjustable 0.1x to 4.0x)
- Resolution Mode: Calculates factor to reach target resolution (p-value based)
- Megapixels Mode: Calculates factor to reach target pixel count (0.5 to 6.0 MP)
Each scaling row shows:
- Control button for immediate application (⬆, 📺, 📷)
- Adjustment method (slider/dropdown)
- Calculated scale factor
- Preview of resulting dimensions
- Radio button to set as active rescale mode
When Prioritize Ratio is enabled, the preview and applied dimensions use the closest exact aspect-ratio match. This can make the final output slightly different from the selected 1.1x, p-value, or MP target.
Important: The rescale_factor output is not a simple "scale from input" value. It's a workflow control parameter designed for professional ComfyUI pipelines.
The rescale_factor represents your scaling intent for downstream nodes (like upscalers), not the relationship between input and current resolution.
- Base Resolution: The current width/height values (set manually, via presets, or auto-detected)
- Scaling Intent: What you want to achieve (manual scale, target resolution, or target megapixels)
- rescale_factor: The calculated multiplier to achieve your scaling intent
- Manual Mode: Uses the manual scale slider value (0.1x to 4.0x)
- Resolution Mode: Calculates factor to reach target resolution (p-value based)
- Megapixels Mode: Calculates factor to reach target pixel count (0.5 to 6.0 MP)
❌ Wrong: "rescale_factor should reset to 1.0 when I connect a new image" ✅ Correct: rescale_factor maintains your scaling intent regardless of input changes
❌ Wrong: "rescale_factor should show the ratio between input and current resolution" ✅ Correct: rescale_factor shows the multiplier needed to achieve your target scaling
Workflow Setup:
1. Connect 512×512 image → auto-detect sets base resolution to 512×512
2. Set resolution target to 1080p → rescale_factor calculates ~2.81x
3. Connect different 1024×1024 image → base resolution updates to 1024×1024
4. rescale_factor recalculates to ~1.41x (to still reach 1080p target)
Why this happens: Your scaling intent (reach 1080p) remains constant, but the required multiplier changes based on the new input resolution.
When using auto-detect with scaling:
- Auto-detect updates base resolution from connected images
- Auto-Fit can match the detected size to the closest preset when enabled
- Auto-Resize can apply the active scaling mode (manual/resolution/megapixel)
- Auto-Snap can round the result to the configured snap value when enabled
- Auto-Calc can apply model-specific constraints when enabled
- rescale_factor recalculates to maintain your scaling intent
- Canvas drag operations update base resolution but preserve scaling intent
This design allows resolution-independent workflows where you can swap input images without breaking your scaling logic.
When dragging the canvas with different modifiers:
- Normal Drag: Updates base resolution, rescale_factor adjusts to maintain scaling intent
- Shift + Drag: Preserves aspect ratio, rescale_factor adjusts accordingly
- Ctrl + Drag: Fine-tuning without snap, rescale_factor adjusts
- Ctrl + Shift + Drag: Precise aspect ratio control, rescale_factor adjusts
The rescale_factor always reflects your active scaling mode, not the drag operation itself.
Snap Button (Actions Section):
- Current resolution: 520×380
- Snap value slider: 64
- Click Snap button → Resolution becomes 512×384 (rounded to nearest 64)
2D Canvas Grid (controlled by properties):
canvas_step_x= 32,canvas_step_y= 32- When dragging on canvas, resolution snaps to 32px increments
- The snap slider does NOT affect this - only
canvas_step_x/yproperties do!
- Select "SDXL" category
- Choose "3:4 Portrait (768×1024)"
- Enable "Custom Calc" for SDXL optimization
- Connect to your SDXL workflow
- Select "Social Media" category
- Choose "Instagram Square (1080×1080)"
- Use resolution scaling to target 2160p for high quality
- Apply rescale factor in upscaling node
- Select "Flux" category
- Enable "Custom Calc" for automatic constraints
- Choose any preset - dimensions auto-adjust to Flux requirements
- Node enforces 32px increments and 4MP limit
- Start with Presets: Use category presets as starting points, then fine-tune
- Enable Custom Calc: For SDXL, Flux, Flux.2, WAN, HiDream Dev, and Qwen-Image workflows to keep dimensions model-friendly
- Use Snap for Clean Values: Helps avoid odd dimensions that may cause issues
- Monitor Info Messages: Pay attention to mode-specific recommendations
- Leverage Rescale Factor: Connect to upscaling nodes for resolution-independent workflows
The node now supports outputs up to 32K resolution. When working with very high resolutions:
- Visual Representation: The 2D canvas may appear distorted at extreme resolutions as it's optimized for the default 2048x2048 range
- Actual Outputs: The width/height outputs maintain correct aspect ratios regardless of canvas appearance
- Solution: Use the Properties panel to adjust
canvas_max_xandcanvas_max_yvalues to match your working resolution range- Example: For 8K work, set both to 8192
- Example: For 32K work, set both to 32768
- This adjustment fixes the visual representation while maintaining accurate output values
- canvas_min_x/y: Minimum values for X and Y axes (default: 0)
- canvas_max_x/y: Maximum values for X and Y axes (default: 2048, adjustable up to 32768)
- canvas_step_x/y: Step values for grid snapping
- canvas_decimals_x/y: Decimal precision settings
- Visual options: dots, frame, snap toggles
Some users have reported that the Resolution Master node appears completely blank when added to the canvas.
This issue is caused by a conflict with comfyui-mixlab-nodes.
✅ Temporary Fix: Disable or uninstall
comfyui-mixlab-nodes– the node will then display and work correctly. 👉 Until a proper fix is implemented incomfyui-mixlab-nodes, the only workaround is disablingcomfyui-mixlab-nodesor manual patch (see below).
🔧 Advanced explanation and manual patch (click to expand)
- If you really want or need to use comfyui-mixlab-nodes despite this, here’s the deal:
The problem occurs because mixlab overrides the
onDrawForegroundmethod of other nodes, which breaks their display. This behavior is, frankly, unacceptable since it hijacks a method other nodes legitimately rely on. The good news is that mixlab only uses this override if the method is defined in the prototype, which means we can adjust it safely.
In ui_mixlab.js (see source line here), replace this part:
const orig = node.__proto__.onDrawForeground;with this safer version:
const orig = node.onDrawForeground ?? node.__proto__.onDrawForeground;With this modification, the Resolution Master node (and potentially other affected nodes) will render correctly again.
You can either apply this tweak manually or report it to the mixlab authors so it can be properly integrated upstream.
📌 Full discussion and context are available here
This node is not compatible with the new Vue Nodes display system.
🔧 How to fix:
Go to Settings → (search) "Vue Nodes" → Disable "Modern Node Design (Vue Nodes)".
This project is licensed under the MIT License. Feel free to use, modify, and distribute.
• ⭐ Give a star — it means a lot to me!
• 🐛 Report a bug or suggest a feature
• 💖 If you’d like to support my work:
👉 GitHub Sponsors