Dynamic image resize (middlek)
Keep every photo in your batch at a sane pixel count
- image
- IMAGE
This is the least glamorous node in the pack and honestly one of the handiest. Product-photo workflows eat batches of arbitrary images - phone shots, catalog exports, images at wildly different resolutions. DynamicImageResize just makes sure every one of them lands inside a pixel-count window you choose, so the VAE encode, ControlNet, and the sampler all get something they can chew without you doing aspect-ratio math by hand.
How it works
It looks at height × width of your image. Above max_pixels, it downscales to fit, preserving aspect ratio. Below min_pixels, it upscales to reach the floor. In between, it passes the image through untouched. Resizing uses ComfyUI's own Lanczos resampler, so quality is on par with the rest of the ecosystem.
The defaults are sensible for SD 1.5: max_pixels is 1,048,576 (1024²) and min_pixels is 262,144 (512²). If you're feeding this pack's IC-Light workflow - which is SD 1.5-based and happiest around 512–768px - those defaults will keep your latents out of trouble.
The inputs
image- anything, single or batched, any resolution.max_pixels- hard ceiling, default1048576.min_pixels- hard floor, default262144.
That's the whole API. There's no width/height here - you're budgeting pixels, not dimensions, and aspect ratio is always preserved. If you're working with an SDXL or Flux workflow, bump the defaults up accordingly (SDXL likes ~1M pixels; Flux wants more).
Why you'd bother
Two reasons. First, a mixed batch of input photos resized into a consistent pixel budget gives more predictable latents and faster runs - you stop letting one 12-megapixel phone photo blow up your VRAM. Second, in this pack's context it sits upstream of the VAE encode / IC-Light chain, and keeping every input in the same range means the text mask from GetTextMask and the detail transfer line up with what the sampler actually sees. Garbage-in sizing is the quietest way to break a batch workflow.
Install
Same pack, same drill:
cd ComfyUI/custom_nodes
git clone https://github.com/MiddleKD/ComfyUI-productfix
pip install -r requirements.txt
Restart and it shows up under the productfix category. No model downloads, no heavy deps for this node specifically.
Gotchas
- Output pixel count isn't exact - the node computes new dimensions from the aspect ratio and rounds, so you'll land near, not exactly on, the target. Irrelevant for sampling; annoying if you're trying to tile exactly.
- Alpha is silently dropped - if your input has 4 channels, it keeps the first 3. Transparent product cutouts get flattened to RGB. Watch that if your pipeline relies on alpha.
- It returns the original tensor unchanged when you're already inside the window - so it's safe to drop into a workflow as a pure no-op guardrail.
There are fancier resize nodes out there (essentials has a full smart-resize suite), but if you just want "keep everything in budget," this one is two inputs and zero opinion.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| max_pixels | INT | 1048576500–9223372036854776000 | — |
| min_pixels | INT | 262144500–9223372036854776000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |