Danbot V2408 Auto Aspect Ratio Tag
Turn any image size into the aspect-ratio tag the model expects
- aspect_ratio_tag
- width
- height
Here's a ComfyUI-ism that trips everyone up on first contact: the v2408 Danbot model is trained on a prompt vocabulary where the aspect ratio is a tag. You don't just set the image dimensions - the model wants to know it should imagine a tall or wide image, via a token like <|aspect_ratio:tall|>. Danbot V2408 Auto Aspect Ratio Tag is the little calculator that converts your width and height into the right token, so the template you build always matches the image you actually render.
It's flagged EXPERIMENTAL in the pack's source, which reads scarier than it is - it's a pure function, two numbers in, a string out, nothing to break.
How it works
The math is refreshingly honest. It computes log2(width / height) and buckets the result:
- ratio ≤ -1.25 →
too_tall - ≤ -0.75 →
tall_wallpaper - ≤ -0.25 →
tall - -0.25 < ratio < 0.25 →
square - < 0.75 →
wide - < 1.25 →
wide_wallpaper - otherwise →
too_wide
So 832×1152 (the default) lands in tall, 1024×1024 in square, 1216×832 in wide. The _wallpaper buckets are the extreme slivers, and too_tall/too_wide are the "don't actually render this, but the tag exists" edges.
The inputs and outputs
Two required INT inputs: width (default 832, steps of 32) and height (default 1152, steps of 32). Both are force_input - they want to be wired from an EmptyLatentImage or a resolution node rather than typed, so the tag tracks your actual canvas. Three outputs:
aspect_ratio_tag- the computed token string, one of the seven buckets above.widthandheight- passed through unchanged, so you can chain this node into the next step without losing the numbers.
In a typical graph it sits between your resolution node and the V2408 Template Config, feeding the aspect-ratio dropdown. Keep it wired and you'll never have a square tag on a wide canvas again.
Install
Pack-standard: ComfyUI Manager → danbot-comfy-node, or
cd ComfyUI/custom_nodes
git clone https://github.com/p1atdev/danbot-comfy-node
cd danbot-comfy-node
pip install -r requirements.txt
(portable: ../../../python_embeded/python.exe -s -m pip install -r requirements.txt.) Restart ComfyUI; the node lives under prompt/Danbooru Tags Translator.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 832 | — |
| height | INT | 1152 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| aspect_ratio_tag | too_tall,tall_wallpaper,tall,square,wide,wide_wallpaper,too_wide | Aspect ratio tag for v2408 model |
| width | INT | Width |
| height | INT | Height |