ComfyUI Node Runs on cloud

Get latent size

DF_Get_latent_size – ComfyUI Node from Derfuu_ComfyUI_ModdedNodes

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

DF_Get_latent_size reads the width and height off a LATENT - but there's a wrinkle here that the pack's README actually calls out explicitly, and it's worth understanding before you use this node: a latent doesn't store the same numbers your image does.

The VAE that sits between pixel space and latent space compresses everything down by a factor of 8 in each dimension - that's just how Stable Diffusion-family models work, and it's why a 1024×1024 image corresponds to a 128×128 latent tensor internally. So if you read a latent's raw stored size, you get numbers 8 times smaller than the actual image it represents. Derfuu's README flags this directly: "Original values for latents are 8 times smaller." DF_Get_latent_size gives you a toggle to handle exactly that.

Inputs and outputs

Two required inputs:

  • latent - the LATENT you're reading
  • original - a toggle deciding which scale the output numbers are in

Two outputs, both INT:

  • WIDTH
  • HEIGHT

With original off, you get the raw stored dimensions of the latent tensor - the smaller, 1/8-scale numbers. Flip original on and the node scales those back up, giving you the equivalent pixel dimensions of the image that latent will decode to. Which one you want depends entirely on what you're feeding the result into: if it's going into more latent-space math (say, DF_Latent_Scale_by_ratio), you generally want the raw latent-scale numbers; if you're computing something that needs to match a real image size - feeding a conditioning area, or comparing against a value from DF_Get_image_size - you want original on.

Where it fits

This shows up in workflows doing dynamic, resolution-aware math around a multi-stage pipeline: reading the current latent size mid-graph to decide how much further to scale it before a second sampling pass, or to compute a conditioning area that needs to track whatever size the latent actually is at that point rather than a number typed in ahead of time. It's the latent-space counterpart to DF_Get_image_size, and the two often get paired with the pack's math nodes to keep a chain of operations consistent regardless of what resolution the workflow started at.

Installing

The whole pack installs together - 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.

Troubleshooting

The most common actual mistake with this node isn't an install problem, it's forgetting the original toggle exists and being confused why your numbers are exactly 8x smaller than expected (or vice versa) - that's the intended behavior described above, not a bug. If a downstream calculation looks off by a clean factor of 8, check this toggle before anything else.

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

Worth knowing about the pack generally: 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 relied on the pack over the long term. This particular node has been a stable fixture and isn't among the ones historically pruned, but if an old workflow throws a missing-node error elsewhere after a pack update, that maintenance history is worth checking before assuming your ComfyUI install itself is broken.

CategoryDerfuu_Nodes/Functions

Inputs (2)

NameTypeDefaultDescription
latentLATENT
originalCOMBO2 options: false, true

Outputs (2)

NameTypeDescription
WIDTHINT
HEIGHTINT