Nodes/ComfyUI Layer Style/LayerUtility: GradientImage V2
ComfyUI Node Runs on cloud

LayerUtility: GradientImage V2

GradientImage V2 — the same gradient generator, with resolution presets

By chflame163·Created 3 years ago·Updated 4 days ago· 3,113
LayerUtility: GradientImage V2
  • size_as
  • image
◄size▾►
â—„custom_width512â–º
â—„custom_height512â–º
â—„angle0â–º
â—„start_color#FFFFFFâ–º
â—„end_color#000000â–º

Same job as the original GradientImage - a two-color linear ramp at an angle - with one real upgrade: instead of typing width and height by hand, you pick from a dropdown of common generation resolutions, or fall back to custom numbers when you actually need something specific. If you're generating gradients meant to line up with SDXL's 1024² sweet spot, or one of the standard 16:9/9:16 buckets, V2 saves you doing that math yourself every time.

This is a fairly common pattern in ComfyUI custom-node land: ship the simple version, then ship a V2 that bolts on the resolution-preset convenience everyone was manually recreating with a Primitive node and a reroute. If you don't care about matching a specific bucket, the original GradientImage is one node lighter and does the same core job.

How it works

Identical gradient math to V1 - start_color interpolates to end_color across the canvas at angle. The only difference is how the canvas dimensions get decided: instead of two free-typed numbers, size picks from the same style of preset list you'll see across several nodes in this pack (Name To Color uses the identical ten-option list), which keeps gradient and swatch canvases consistent with each other if you're generating several as part of one composite.

The inputs and outputs that matter

  • size - a dropdown with ten options: custom plus nine common presets (1024×1024, 768×512, 512×768, 1280×720, 720×1280, 1344×768, 768×1344, 1536×640, 640×1536). Pick a preset and it just works; pick custom to use your own numbers.
  • custom_width / custom_height (default 512 each) - only take effect when size is set to custom.
  • angle, start_color, end_color - same as V1: direction of the ramp, and the two color stops.
  • size_as (optional, accepts any upstream value) - wire in another image, or a GetImageSize node's original_size output, and the gradient generates at that exact resolution instead of a fixed preset. Handy when you're building a gradient to composite with a specific photo rather than a standard generation size.

Output: a single image.

How to install it

Search ComfyUI Layer Style in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle
pip install -r ComfyUI_LayerStyle/requirements.txt

Restart; find it under 😺dzNodes → LayerUtility. No models needed.

Common issues

The one thing people trip on: leaving size on a preset while typing new numbers into custom_width/custom_height - those get silently ignored until you actually switch size to custom. If your gradient stubbornly keeps generating at 1024×1024 no matter what you type, that's why. Past that, the same limits as V1 apply: it's still strictly two colors and a straight ramp, no curves, no extra stops, no radial mode - V2 only fixed the sizing annoyance, not the feature set. If you find yourself wanting size_as and a preset dropdown at the same time, know that size_as wins whenever something's actually connected to it, regardless of what size is set to - treat the dropdown as the fallback, not a second source of truth once you've wired an upstream size reference in.

Category😺dzNodes/LayerUtility

Inputs (7)

NameTypeDefaultDescription
sizeCOMBO10 options: custom, 1024 x 1024, 768 x 512, 512 x 768, 1280 x 720, 720 x 1280, +4
custom_widthINT5124–99999—
custom_heightINT5124–99999—
angleINT0-360–360—
start_colorSTRING#FFFFFF—
end_colorSTRING#000000—
size_asopt*—

Outputs (1)

NameTypeDescription
imageIMAGE—