arkennemasis Match Aspect (output follows the input)
Making the generator's output follow the shape of your upload
- image
- base
- settings
- aspect_ratio
- width
- height
Image-edit models have a habit of reframing your picture. You upload a landscape crop, the generator's aspect_ratio is set to "auto," and "auto" turns out to mean "whatever I guessed" - so the output comes back reshaped and you get a portrait of a landscape. ArkMatchAspect is the fix: it measures the image you're editing and emits a settings bundle that pins the generator's output to that shape. Wire its settings into the image node's settings socket and the generator's own aspect_ratio widget is ignored - the output follows the upload.
The mechanism exists because ComfyUI rejects a plain STRING link into a COMBO widget, so this pack bundles aspect_ratio, quality and friends into one typed value (ARK_IMAGE_SETTINGS) that travels over a socket. MatchAspect is a producer of that bundle.
How it works
Give it the image being edited. The node reads its dimensions - and yes, the source comments carry a warning that IMAGE tensors are (B, H, W, C), so height comes before width, and getting it backwards turns every landscape thumbnail into a portrait request. Then mode decides the value:
nearest supported ratio(default) - names one of the model's own canvas ratios. This is what actually renders; the model reliably offers these canvases.exact pixels of the input- asks for the input's literal size. More precise in the prompt, but the model may not offer that canvas, and then something has to give.
The optional base input is an upstream ArkImageGenSettings to extend: everything in it passes through, and only aspect_ratio is replaced. That's how you share most settings across many generators and still pin shape per-upload.
There's a subtle honesty touch: if the input isn't close to any ratio the model renders (roughly 6% in log space), the node says so in its console output - "no close match - the output will be reshaped" - rather than letting you assume the generator ignored you.
Outputs: settings (wire into the image node's settings socket), plus aspect_ratio (the value it chose), width, and height (the measured dimensions) as plain values you can inspect.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/Hishamahmer/comfyui-arkennemasis
pip install replicate httpx
Restart ComfyUI. No models or keys - it's a measurement node.
Troubleshooting
- Output still reframed: check the image node is actually reading the
settingssocket. If you set the widget manually and wire settings in, the socket wins - but if it's not wired, the widget is what runs. - A landscape turns portrait: you're in
exact pixelsmode on a model that won't render that canvas, or the H/W swap got you. Switch tonearest supported ratio. - The
basepass-through is the power move: one shared settings node upstream, this node overriding only shape, and 24 generators all agreeing.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | The image being edited. Its dimensions decide the output shape. | |
| mode | COMBO | 'nearest supported ratio' names one of the model's own canvases and is what actually renders. 'exact pixels' asks for the input's literal size — more precise in the prompt, but the model may not offer that canvas. | |
| baseopt | ARK_IMAGE_SETTINGS | An upstream ArkImageGenSettings to extend. Everything in it is passed through; only aspect_ratio is replaced. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| settings | ARK_IMAGE_SETTINGS | — |
| aspect_ratio | STRING | — |
| width | INT | — |
| height | INT | — |