Image_safe_size
Clamp an image into a Seedream-safe resolution range
- image
- IMAGE
The node description doesn't spell out what "safe" means in general - it just gives you two concrete number ranges: seedream4.5: 2560*1440 - 4096*4096 and seedream4.0: 1280x720 - 4096x4096. Seedream is ByteDance's closed, API-only image model family, and like most hosted image APIs it rejects requests outside a fixed resolution window rather than silently resizing them for you. This node exists to keep you inside that window before you make the call, so you don't burn an API request on a size error. If you're not calling a Seedream-style API, you can still use it as a generic min/max/divisor clamp - the defaults just happen to match Seedream's numbers.
The inputs and outputs that matter
constraint_mode(BOOLEAN, default true) - no tooltip ships with this field, so treat the "on" behavior as the documented one: it enforces the min/max rules below. What flipping it off actually changes isn't specified anywhere in the schema or README, so if you turn it off, check the output dimensions rather than assuming what happens.min_width/min_height(default 2560 / 1440) - the floor. Anything smaller gets scaled up to at least this.max_width/max_height(default 4096 / 4096) - the ceiling. Anything larger gets scaled down to fit.divisor(default 8) - the final width and height get rounded to a multiple of this. 8 is the standard VAE downscale factor most diffusion pipelines expect; leave it unless you know the target API wants something else.
One output: IMAGE, resized into the safe range and ready to hand to whatever consumes it next - an API call node, a save step, or further processing.
How to install it
ComfyUI Manager: search ComfyUI-Apt_Preset, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
pip install -r requirements.txt
install.bat is the Windows installer; on Linux (comfy.icu included) pip install -r requirements.txt is the real step. No model downloads for this node - it's just resolution math, no weights involved.
Common issues
The defaults are tuned to Seedream's documented ranges, not to any general diffusion model's preferred size - if you're feeding a local SDXL or Flux checkpoint instead of an API, these min/max numbers (2560–4096 on the low end alone) are almost certainly larger than you want and will just waste VRAM and time. Set min_width/min_height/max_width/max_height to match whatever you're actually targeting before relying on the defaults.
The other thing worth knowing: the 4.0 versus 4.5 ranges in the description aren't both baked into the node's live behavior - the schema only exposes one set of min/max/divisor fields, so which Seedream generation's range you get is entirely up to what you type into those four number fields yourself. The node doesn't know which Seedream version you're targeting; you have to set the bounds to match it.
As with every node in this pack, a fresh install pulls in a large, mostly-unrelated requirements.txt (onnxruntime, gguf, transparent-background, scenedetect, and more, for the pack's other 100+ nodes). There's a real report on r/comfyui of a from-scratch ComfyUI-Apt_Preset install failing to import - if that happens, check the ComfyUI console for the actual missing-package error above the generic IMPORT FAILED line, fix it, and re-run pip install -r requirements.txt.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| constraint_mode | BOOLEAN | true | — |
| min_width | INT | 256064–4096 | — |
| min_height | INT | 144064–4096 | — |
| max_width | INT | 4096128–8192 | — |
| max_height | INT | 4096128–8192 | — |
| divisor | INT | 81–64 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |