Nodes/ComfyUI-ArchAi3d-Qwen/๐Ÿงฎ Smart Tile Calculator
ComfyUI Node

๐Ÿงฎ Smart Tile Calculator

Do the tiled-upscale math so you don't have to

By amir84ferdosยทCreated 11 months agoยทUpdated 5 months agoยท 70
๐Ÿงฎ Smart Tile Calculator
  • image
  • scaled_image
  • upscale_by
  • tile_width
  • tile_height
  • mask_blur
  • tile_padding
  • seam_fix_width
  • seam_fix_mask_blur
  • seam_fix_padding
  • tiles_x
  • tiles_y
  • total_tiles
  • efficiency
  • crop_factor
  • output_width
  • output_height
  • debug_info
  • guide_size
  • bundle
โ—„target_upscale2.00โ–บ
โ—„min_tile_mp1.00โ–บ
โ—„max_tile_mp2.00โ–บ
โ—„upscale_tolerance0.50โ–บ
โ—„scaling_modeProportionalโ–บ
โ—„overlap_scale1.00โ–บ

The annoying part of tiled upscaling was never the sampling - it's the arithmetic. Pick a tile size too small and you're sampling four hundred tiles; too big and you OOM. The original Smart Tile Calculator is a math node that figures it out for you: it analyzes your image's dimensions, searches tile sizes and upscale factors together, and hands you a complete set of numbers you can plug straight into Ultimate SD Upscale. It's the opening move of the "Smart Tile" subsystem in ComfyUI-ArchAi3d-Qwen (Amir Ferdos's pack - the tiling half that the README doesn't document).

What it optimizes

The core tension it solves: your target upscale factor and your tile size interact. If you pick a 2x upscale and a 1024px tile, the last row and column of tiles usually overhang - and every pixel of overhang is wasted VRAM. The node runs a two-phase search:

  1. Phase 1: hunt for a mathematically "perfect" alignment - a tile size and upscale that divide the output cleanly (100% efficiency, zero waste).
  2. Phase 2: if no perfect fit exists, fall back to a near-perfect brute-force search (95%+ efficiency).

upscale_tolerance is the lever that makes this work: it's how much the actual upscale may deviate from your target (default 0.5 = ยฑ50%), because loosening the upscale constraint is what frees the tile grid to align perfectly.

Inputs that matter

  • image - the source, whose aspect ratio drives everything.
  • target_upscale - your desired factor (default 2).
  • min_tile_mp / max_tile_mp - the megapixel range to search. The tooltip notes 2.0 MP is the sweet spot for z-image-turbo. Set min = max to force a fixed tile size.
  • scaling_mode - Proportional scales blur/padding with tile size; Fixed uses USDU defaults.
  • overlap_scale - a global multiplier on overlap (0.5 = half the overlap, 1.5 = 50% more).

Outputs

Nineteen of them, but they fall into three groups. Grid geometry: tile_width, tile_height, tiles_x, tiles_y, total_tiles, overlap-related values (tile_padding, mask_blur, seam_fix_width, seam_fix_mask_blur, seam_fix_padding), which map 1:1 onto Ultimate SD Upscale's inputs. The image: scaled_image (already upscaled) and output_width/output_height. Bookkeeping: upscale_by, efficiency, crop_factor, guide_size, debug_info, and - the one to notice - bundle, a SMART_TILE_BUNDLE that carries everything to the newer Smart Tile SEGS/Conditioning/Detailer nodes so you don't wire fifteen cables.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/amir84ferdos/ComfyUI-ArchAi3d-Qwen.git
cd ComfyUI-ArchAi3d-Qwen
pip install -r requirements.txt

Or ComfyUI Manager โ†’ "ArchAi3d Qwen". Pure math - no model downloads. Free for personal use; paid license for commercial work.

The honest take

This is the oldest member of the calculator family, and its successors (V3, V4, V5, the Solver) are stricter about 64-pixel alignment, which modern transformer models like Flux and Qwen genuinely want. Use V1 if you're targeting Ultimate SD Upscale with an SD1.5/SDXL model or z-image-turbo; reach for the newer ones when the model is Flux-class. Either way, the bundle output is the upgrade path - it's how this old node talks to the rest of the Smart Tile suite.

CategoryArchAi3d/Upscaling/Smart Tile

Inputs (7)

NameTypeDefaultDescription
imageIMAGEInput image to analyze for optimal tile/upscale calculation
target_upscaleFLOAT2.000.5โ€“4Desired upscale factor (will be optimized within tolerance)
min_tile_mpFLOAT1.000.5โ€“4MINIMUM tile megapixels to search. Set equal to max for fixed tile size.
max_tile_mpFLOAT2.000.5โ€“4MAXIMUM tile megapixels (2.0 for z-image-turbo). Node searches min to max.
upscale_toleranceFLOAT0.500โ€“0.75How much upscale can deviate from target (0.5 = ยฑ50%). More tolerance = better optimization.
scaling_modeCOMBOProportionalProportional: scale blur/padding with tile size. Fixed: use USDU defaults
overlap_scaleFLOAT1.000.25โ€“2Global overlap multiplier: 1.0=100%, 0.5=50% less overlap, 1.5=50% more overlap

Outputs (19)

NameTypeDescription
scaled_imageIMAGEโ€”
upscale_byFLOATโ€”
tile_widthINTโ€”
tile_heightINTโ€”
mask_blurINTโ€”
tile_paddingINTโ€”
seam_fix_widthINTโ€”
seam_fix_mask_blurINTโ€”
seam_fix_paddingINTโ€”
tiles_xINTโ€”
tiles_yINTโ€”
total_tilesINTโ€”
efficiencyFLOATโ€”
crop_factorFLOATโ€”
output_widthINTโ€”
output_heightINTโ€”
debug_infoSTRINGโ€”
guide_sizeINTโ€”
bundleSMART_TILE_BUNDLEโ€”