Universal Size Unpack
Latent-ready dimensions straight from the loader — no pixels decoded
- media_data
- width
- height
- megapixels
- aspect_ratio
- ratio_str
- has_media
This is the quiet one in the pack, and the one that saves you a whole class of silly mistakes. UniversalSizeUnpack takes the loader's MEDIA_DATA and hands you the dimensions as plain INT/FLOAT/STRING values - without decoding a single pixel. It exists for one reason: you shouldn't have to guess the width and height to type into an Empty Latent Image. Ask this node instead, and let the numbers stay in sync with whatever you cropped or resized in the loader.
How it works
The node reads the JSON state and does the math client-side-of-the-graph:
- If a file is loaded, it pulls the post-edit dimensions - the crop box from your visual edit, clamped to the megapixel ceiling and snapped to the 32px grid exactly the way the image/video unpack nodes will.
- If nothing is loaded (canvas mode), it reads the loader's canvas output size you set via the aspect preset and MP target.
- It also returns the aspect ratio as a float (
1.7778for 16:9), a human-readableratio_str("16:9","1:1","free"), and ahas_mediaboolean that tells you whether there's actually a file behind this data.
Because it only reads JSON metadata, it's near-instant - no point decoding a 4K video just to learn its aspect ratio.
The outputs
width/height(INT) - target output dimensions, already 32-snapped for SD1.5/SDXL/Flux latent compat.megapixels(FLOAT) - resolution in MP.aspect_ratio(FLOAT) - width ÷ height.ratio_str(STRING) - the friendly name, e.g."16:9".has_media(BOOLEAN) - true when a valid file exists, false in canvas mode. Handy for gating logic in a workflow that has both modes.
The obvious wiring: width and height into an Empty Latent Image, or into a conditioning prep node, so your generation resolution tracks your loader exactly. Feed ratio_str somewhere for a filename tag and you've got "16x9" baked into your save name for free.
Installing
The pack-wide story applies: ComfyUI Manager, search "Universal Media Loader", or
cd ComfyUI/custom_nodes/
git clone https://github.com/Fictiverse/ComfyUI_UniversalMediaLoader.git
Restart ComfyUI. No extra dependencies, no models.
Where people trip
- Audio input returns all zeros - dimensions, ratio, everything. The pack treats "size" as a visual concept, and audio has no canvas, so this node quietly zeroes out. Don't panic; it's intentional, and
has_mediais still meaningful. - In canvas mode, the numbers only mean something if you set the loader's canvas first. A default loader gives you a 1:1-ish 864-ish box; pick your aspect preset and megapixel target on the loader and this node becomes a proper resolution planner.
- The ratio comes back as a float you'd round -
ratio_stris the friendlier readout for humans,aspect_ratiois the one for math.
It's not flashy, but in a media-heavy workflow this node is the difference between "I typed 1152×640 and it looked wrong" and "the numbers came from the thing I actually cropped."
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| media_dataopt | MEDIA_DATA | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| megapixels | FLOAT | — |
| aspect_ratio | FLOAT | — |
| ratio_str | STRING | — |
| has_media | BOOLEAN | — |