Nodes/GIF Toolkit/GIF Prepare / Preset
ComfyUI Node

GIF Prepare / Preset

The node that decides how big your GIF is

By oekobudde·Created 28 days ago·Updated 26 days ago· 1
GIF Prepare / Preset
  • images
  • video_info
  • images
  • fps
  • frame_count
  • duration_seconds
  • width
  • height
  • settings
◄presetBalanced►
◄aspect_ratioAuto (Input Image)►
◄custom_long_side320►
◄custom_fps8►
◄custom_duration_seconds5.0►

You loaded a 1080p, 30 fps, forty-second clip and you're trying to make a GIF for a chat window. Left alone, that's hundreds of megabytes of something no client will even animate. Prepare / Preset is where you fix that, and it's the node the author tells you to start on: pick Balanced, leave the ratio on Auto, move on.

How it works

Four operations, in this order, all in one pass over the tensor batch.

Resample. It reads the source frame rate out of the VHS_VIDEOINFO dictionary VideoHelperSuite hands it, then selects frames by index arithmetic to hit your target FPS. It's pure frame-dropping - no interpolation, no optical-flow blending - which is the right call for GIFs. Interpolated frames look like ghosts once they're crushed into a 256-colour palette and looped forever.

Crop. If you left the ratio at Auto (Input Image), your aspect is preserved untouched. Pick 1:1, 16:9, 9:16, 4:3 or 3:4 and it center-crops to that ratio. Center-crop, not letterbox - heads at the edge of frame will get cut, and no setting will pad it back.

Resize. The long side is set to the preset's pixel value and the other dimension follows, then both are rounded to even numbers. Bicubic with antialiasing, so the downscale doesn't alias into shimmering garbage in the low-res GIF.

Report. It hands back the fps it actually used, the frame count, the real duration, width and height, plus a settings string like Balanced | 320x180 | 8 FPS | 5.00s | ratio=Auto (Input Image) you can pipe into a Note node.

Presets, and the numbers behind them

| Preset | Long side | FPS | Max duration | Roughly | |---|---:|---:|---:|---| | Small | 288 px | 6 | 4.0 s | 24 frames - chat-sized | | Balanced | 320 px | 8 | 5.0 s | 40 frames - the default for a reason | | Quality | 384 px | 10 | 5.5 s | 55 frames, noticeably bigger file | | Custom | your call | your call | your call | 128–1024 px, 2–24 fps, 0.5–30 s |

GIF file size is roughly frames × pixels × however much motion and noise the source has. Both dials that matter are here, and this node is a decent approximation of "the size knob."

Note what the field default is: Balanced, not the older preset node's Small.

The inputs and output that matter

  • images (IMAGE) - the loaded frames.
  • video_info (VHS_VIDEOINFO) - required, and this is the one that trips people. There is no way to type the fps in by hand; the node needs the info dictionary that VHS_LoadVideo produces, which is why you cannot use this pack without VideoHelperSuite.
  • preset, aspect_ratio - the two you'll actually touch.
  • custom_long_side / custom_fps / custom_duration_seconds - only read when preset is set to Custom. Set a preset and these widgets sit there doing absolutely nothing. That's the single most common "why is it ignoring my settings" in this pack.
  • images, fps, frame_count, duration_seconds, width, height, settings come out. fps is the one you wire forward - into GIF Text Overlay, so blink timing matches, and into the VHS Video Combine nodes' frame_rate.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/oekobudde/ComfyUI-GIFToolkit.git

or Manager → search GIF Toolkit → Install → full restart. The pack itself declares no pip dependencies. Also install ComfyUI-VideoHelperSuite from its own repo or through Manager - without it you get no VHS_LoadVideo and no VHS_VIDEOINFO, and this node can't be wired up at all.

Common issues

Target FPS higher than the source and nothing changes. It downsamples only - the code takes min(target_fps, source_fps), so asking for 24 fps from a 12 fps load gives you 12. If you want more frames, raise force_rate on the VHS Load Video node instead.

Duration shorter than you asked for. The node clamps to what's actually in the batch. VHS_LoadVideo has a frame_load_cap (144 by default) and a force_rate; if those only delivered three seconds of frames, a five-second request can't be honoured.

The GIF looks fine but the loop stutters. A crop or a dropped frame at the end is what breaks the illusion. Keep the source clip a second or two longer than your target duration so the resample doesn't end on a half-motion.

One honest caveat from the author: the presets are named for quality tiers, not file sizes. The source comment says it plainly - GIF size depends on motion, noise and colour complexity, so two clips at "Balanced" can land a factor of three apart. If a service rejects your upload, drop duration first, then long side, then FPS.

CategoryGIF Toolkit

Inputs (7)

NameTypeDefaultDescription
imagesIMAGE—
video_infoVHS_VIDEOINFO—
presetCOMBOBalanced4 options: Small, Balanced, Quality, Custom
aspect_ratioCOMBOAuto (Input Image)6 options: Auto (Input Image), 1:1, 16:9, 9:16, 4:3, 3:4
custom_long_sideINT320128–1024—
custom_fpsFLOAT82–24—
custom_duration_secondsFLOAT5.00.5–30—

Outputs (7)

NameTypeDescription
imagesIMAGE—
fpsFLOAT—
frame_countINT—
duration_secondsFLOAT—
widthINT—
heightINT—
settingsSTRING—