Nodes/LF Nodes/Is image in landscape res.?
ComfyUI Node

Is image in landscape res.?

Ask the image which way it's facing, then branch on the answer

By lucafoscili·Created 2 years ago·Updated 2 years ago· 50
Is image in landscape res.?
  • image
  • ui_widget
  • is_landscape
  • height
  • width
  • is_landscape_list
  • heights_list
  • widths_list

A tiny logic node that checks an image's orientation and tells you the answer as a clean boolean. LF_IsLandscape looks at an image - or a batch of images - and reports whether it's in landscape resolution, plus its exact height and width. It's the kind of node you install for one workflow and then find yourself using everywhere.

The canonical use is aspect-ratio-aware pipelines. You have a batch of mixed-orientation images and you need to treat landscape and portrait differently - different denoise, different crop, different upscaler, different target size. This node gives you the boolean to branch on and the dimensions to compute with, all in one place. Wire is_landscape into a switch or a conditioning selector and your graph starts making per-orientation decisions on its own.

How it works

One required input: image, the image or batch to inspect. From there the node measures width and height and compares them.

The outputs are generous and split between scalar and list forms:

  • is_landscape - a BOOLEAN: true when the image is wider than tall.
  • height and width - the pixel dimensions, for downstream math.
  • is_landscape_list, heights_list, widths_list - the same three values as lists, when you fed in a batch.

The scalar/list split is the pack's house style: single values for linear chains, list variants for batch iterations. If you're processing a folder of mixed images, grab the list outputs and let a loop make per-image decisions.

Installing it

Part of LF Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/comfyui-lf

Restart ComfyUI, or search LF Nodes in ComfyUI Manager. No model downloads; trivial dependencies, since this is pure geometry.

Gotchas

"Landscape" here is purely about aspect ratio - a square image is not landscape, and there's no tolerance knob. If you need "portrait-ish" with a threshold, this node won't do it; you'll want a resolution/ratio calculator node instead. Also, the boolean output only tells you the answer; it doesn't resize anything. It's a sensor, not an actuator - feed its output into something that does the work.

And the pack note: comfyui-lf is legacy, frozen at Feb 2025, with development moved to lucafoscili/lf-nodes. The frozen build is stable, and a geometry check like this one is exactly the kind of node that doesn't age.

Category✨ LF Nodes/Logic

Inputs (2)

NameTypeDefaultDescription
imageIMAGEInput image/images.
ui_widgetoptKUL_TREE[object Object]

Outputs (6)

NameTypeDescription
is_landscapeBOOLEAN
heightINT
widthINT
is_landscape_listBOOLEAN
heights_listINT
widths_listINT