Nodes/ComfyUI-Image-Effects/๐Ÿ”ท Polygon
ComfyUI Node

๐Ÿ”ท Polygon

Mosaic stylization without a Delaunay headache

By orion4dยทCreated about a year agoยทUpdated about a year agoยท 28
๐Ÿ”ท Polygon
  • image
  • IMAGE
โ—„polygon_sides6โ–บ
โ—„polygon_size30โ–บ
โ—„reduction_factor0.5โ–บ
โ—„color_modeaverageโ–บ
โ—„edge_preservation0.3โ–บ
โ—„rotation0โ–บ
โ—„outlinefalseโ–บ

If Triangulate is the "low-poly portrait" node, Polygon is its orderly cousin: instead of scattering triangles, it tiles your image with a regular grid of same-sized polygons and recolors each one. Think of the faceted-shape filters you've seen in photo apps - geometric mosaic, stained-glass-lite - rather than an organic mesh. Same family, different personality, and for some subjects it looks a lot better.

It ships in orion4d's Image Effects pack alongside Triangulate and Voronoi under Geometric effects. Where those two get fiddly with seed placement, Polygon is the easiest to reason about: you pick the shape, the size, and how aggressive the reduction is, and the rest is predictable. If you're making album art, posters, or anything that wants a clean "geometric stylization" treatment without looking like a glitch, start here.

How the reduction works

The mechanism is a form of intelligent downsampling: it shrinks the image by reduction_factor, then draws a polygon centered on each downscaled cell back at full size. The polygon's color comes from the source region behind it - averaged, or the dominant color in that region, or just the center pixel. The polygon_size slider sets how big each shape is; bigger shapes, bolder mosaic. edge_preservation is the sneaky-important one: it detects edges with Canny and blends the original pixels back in along them, so outlines of faces and objects stay readable instead of dissolving into shapes.

The controls that matter:

  • polygon_sides (default 6, range 3โ€“12) - 3 makes triangles (closest to low-poly), 4 makes squares, 6+ gets into honeycomb territory.
  • polygon_size (default 30) - the footprint of each polygon. 10โ€“30 is fine detail; 50+ is chunky mosaic.
  • reduction_factor (default 0.5) - how much the image is downscaled before shapes are drawn. Lower = more polygons = closer to the original.
  • color_mode - average (muted, blended), dominant (flat, posterized), or center (grab the center pixel, rawest).
  • rotation - rotate the whole polygon grid in 15ยฐ steps; 30ยฐ on hexagons looks nice.
  • outline - draw a 1px black border around every shape for a stained-glass look.

Output is a single IMAGE you can send to Preview, Save, or into another effect.

What to watch for

The default combo (6 sides, size 30, reduction 0.5) is a decent starting point but reads "tile floor" more than "art" on some photos - drop to 3 sides and crank edge_preservation to get the good low-poly look. It's CPU-only and processes just the first frame of a batch, same as every node in this pack, so keep it on single images. It does the polygon pass on the reduced grid, so it's one of the faster geometric nodes here - the slowness trap is Triangulate and Voronoi, not this one.

Install

Via ComfyUI Manager, search ComfyUI-Image-Effects. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/orion4d/ComfyUI-Image-Effects.git
cd ComfyUI-Image-Effects
pip install -r requirements.txt

Restart, then right-click โ†’ Add Node โ†’ Image Effects โ†’ Polygon. No model downloads - pure numpy/OpenCV on CPU. If pip fights you on the optional extras in requirements.txt (there's a cupy-cuda11x line the code never imports), installing numpy opencv-python scipy Pillow is enough.

CategoryImage Effects

Inputs (8)

NameTypeDefaultDescription
imageIMAGEโ€”
polygon_sidesINT63โ€“12โ€”
polygon_sizeINT3010โ€“100โ€”
reduction_factorFLOAT0.50.1โ€“0.9โ€”
color_modeoptCOMBOaverage3 options: average, dominant, center
edge_preservationoptFLOAT0.30โ€“1โ€”
rotationoptFLOAT00โ€“360โ€”
outlineoptBOOLEANfalseโ€”

Outputs (1)

NameTypeDescription
IMAGEIMAGEโ€”