ComfyUI Node Runs on cloud

Get image size

DF_Get_image_size – ComfyUI Node from Derfuu_ComfyUI_ModdedNodes

By Derfuu·Created 3 years ago·Updated 2 years ago· 455
Get image size
  • image
  • WIDTH
  • HEIGHT

DF_Get_image_size does the obvious thing: plug an image into it, and it reads back the actual width and height as two separate integers you can wire into other nodes. It sounds trivial until you notice how often ComfyUI workflows don't know their own image size - you load an image, or one comes out of a previous step, and unless you hardcode the dimensions somewhere, nothing downstream automatically knows how big it is. This node is the fix: instead of typing "1024, 768" into a widget and hoping it stays right, you read the real size off the actual image flowing through the graph.

It's part of Derfuu_ComfyUI_ModdedNodes, a math-and-utility pack that's been around since ComfyUI's early days in 2023, and this is one of its more genuinely useful nodes - the kind that shows up in workflows that don't otherwise touch anything else from the pack. Anywhere you want a calculation to follow the image instead of assuming a fixed resolution, this is where that calculation starts.

Input and outputs

One required input:

  • image - an IMAGE

Two outputs, both INT:

  • WIDTH
  • HEIGHT

That's the whole node. From here, the width and height typically feed straight into this pack's math nodes - DF_Divide to compute an aspect ratio, DF_Sum or DF_Subtract to add padding, or directly into DF_Image_scale_by_ratio if you want a scale factor derived from the source size rather than picked arbitrarily.

Where it fits in a workflow

The classic use case is a workflow that needs to adapt to whatever image gets loaded rather than assuming one fixed resolution - batch-processing a folder of differently-sized images, or building a resize step that preserves aspect ratio without you having to know the source dimensions ahead of time. Read the size, do some math on it, feed the result into a scaling or conditioning node. It's also handy purely for debugging: wire the outputs into a Show Text / Debug node just to confirm what size an image actually is at a given point in a long graph, since it's easy to lose track after a few resize and crop steps.

Installing

The whole pack installs as one repository - there's no way to grab a single node from it. Through ComfyUI Manager: search Derfuu_ComfyUI_ModdedNodes, install, restart ComfyUI. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes

then restart. No models, no unusual dependencies - pure Python logic, so install is quick and rarely a problem.

Troubleshooting

If DF_Get_image_size doesn't show up in the node menu right after installing, restart the server and hard-refresh your browser tab - that clears up the large majority of "installed but not visible" cases, and it's a generic ComfyUI frontend quirk, not something specific to this pack.

Worth knowing about this pack in general: its maintainer has, in the past, removed deprecated nodes outright on updates rather than keeping a legacy-labeled copy around, which has broken workflows for people who leaned on the pack over the long term. The functional nodes like this one - reading a size rather than computing derived math - have been stable fixtures since the pack's early days and aren't the ones that have historically been pruned, but it's worth checking the pack's GitHub for a rename if an old workflow throws a missing-node error somewhere after an update, before assuming your ComfyUI install itself is broken.

CategoryDerfuu_Nodes/Functions

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (2)

NameTypeDescription
WIDTHINT
HEIGHTINT