view_GetShape
Pull width, height, batch and channels off any tensor
- tensor
- width
- height
- batch_size
- long
- short
view_GetShape reads the shape of an image, latent, or mask tensor and splits it into four plain INT outputs: width, height, batch_size, and channels. Instead of guessing whether your latent is 128×128 or 1024×1024, you wire it in and read the truth.
This is a workhorse for anyone building dynamic workflows - the ones where you don't hardcode resolutions because the input changes every run. Upscalers are the classic case: you want to upscale to 2× the actual incoming size, not a size you typed last week and forgot to update. Crop-to-region math, aspect-ratio logic, batch-size-aware loops - all of them need the real dimensions at runtime, and this node hands them to you as integers you can feed straight into math nodes.
How it works
The tensor input accepts IMAGE, LATENT, or MASK. The node inspects the tensor's shape and decomposes it into the four components. The subtlety is latent space: a latent for a 1024×1024 image is only 128×128, because the VAE compresses spatially by 8× on most architectures. So the numbers this node reports for a LATENT are the latent's own dimensions, not the pixel dimensions of the eventual image. If you're computing a pixel-space resize from a latent's shape, remember the scale factor - that's where people quietly burn a generation.
The inputs and outputs that matter
tensor(IMAGE, LATENT, or MASK) - the required input.width(INT) - the tensor's width dimension.height(INT) - height.batch_size(INT) - how many entries are stacked in the batch.channels(INT) - the channel count.
How to install it
It's part of the ComfyUI-Apt_Preset pack. Install via ComfyUI Manager (search "ComfyUI-Apt_Preset") or:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
then run install.bat (Windows) or pip install -r requirements.txt, and restart ComfyUI. No model downloads.
Common issues & troubleshooting
The latent-space trap above is the main one - check whether you're feeding an IMAGE or a LATENT and interpret accordingly. Channel order is the other thing to keep in mind: for an IMAGE the width and height are usually reported in the order the tensor stores them, so if your math produces a swapped aspect ratio, flip width/height before assuming the node is wrong. And if the numbers don't update, same rule as every display node in this pack: the values reflect the last run, so queue a run after changing the input.
A practical example: pair it with an upscaler's scale factor - multiply the reported width and height by 2 before feeding the result into a Latent Upscale, and you get a genuine 2× upscale that tracks the real input instead of a hardcoded value. That's the whole appeal of the node: your workflow stops assuming and starts reading.
Pack-level caveat: niche pack, Bilibili-based author, translated README. The recurring real-world failure is IMPORT FAILED for the whole pack when dependencies are skipped - run install.bat, restart ComfyUI, and confirm the node loads before debugging your shape math.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| tensor | IMAGE,LATENT,MASK | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| batch_size | INT | — |
| long | INT | — |
| short | INT | — |