Word Cloud
The ComfyUI_WordCloud generator
- color_ref_image
- mask_image
- image
- mask
You want a wall of text where the words are sized by how often they show up, layered over an image, with a clean alpha channel so you can composite it - and you want it inside ComfyUI, not in some web tool you have to screenshot. That's this node. The name is not a lie: it's the word_cloud Python library by Andreas Mueller, wrapped into a graph node, plus jieba for splitting Chinese text that has no spaces to split on. Paste in a prompt, a tag list, or a whole transcript and get back a poster-shaped typography image.
It's from chflame163, the same author behind the big LayerStyle and DzNodes pack families. Expect Chinese-first documentation habits and a 😺dzNodes category prefix, but the code itself is a thin, readable wrapper - no model downloads, no network calls, nothing spooky.
Why you'd reach for it
The realistic uses: generate a background of keywords for a thumbnail or title card, make a tag-frequency cloud from a dataset's captions, or drop a word cloud into an img2img pass as a starting image where the text gets interpreted and re-rendered. The MASK output is the underrated part - because the node outputs image and mask, you can composite the cloud over anything with a normal Blender-style mask operation instead of fighting a hard background.
How it works
jieba chops Chinese into words, then WordCloud().process_text() counts frequencies for everything. keynote_words you set get their frequency artificially boosted by keynote_weight (default 60, added on top of the current max), so you can force "BREAKING" or "sale" to dominate without writing it a thousand times. stopwords are dropped - and the node also deletes them from the frequency dict afterward, a deliberate workaround for a quirk in the underlying library.
Layout is standard word_cloud: word size maps to frequency, prefer_horizontal (0.9 default) decides the horizontal/vertical mix, max_words caps the count, and random_state set to -1 means a fresh layout every run while any other number seeds it. Two inputs change the whole output: color_ref_image recolors the text using that image's palette (which overrides colormap), and mask_image turns the cloud into a silhouette - white areas are cut out, and it silently forces the output size to match the mask, ignoring width/height. transparent_background on (default) gives you RGBA plus the mask; turn it off and background_color (#FFFFFF) applies instead.
The inputs that actually matter
- text - your corpus. Leave it empty and you get a demo string, which is a nice touch.
- font_path - the dropdown is built from every
.ttf/.otfin the directory named infont_dir.ini. - mask_image and color_ref_image - the two shortcuts to a shaped, nicely-colored result.
- stopwords / keynote_words - comma (Chinese or English) or space separated.
Outputs: image (with alpha) and mask, both wired into any preview, Save Image, or compositing setup.
Installing it
ComfyUI Manager finds it by searching "WordCloud" or the author name. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_WordCloud
cd ComfyUI_WordCloud
# on the embedded Python build:
..\..\..\python_embeded\python.exe -m pip install -r requirements.txt
Then restart ComfyUI. The requirements (numpy, pillow, torch, matplotlib, wordcloud, jieba) are all things you almost certainly already have - torch ships with ComfyUI. There are no model files to hunt down; the only asset is the bundled Alibaba-PuHuiTi-Heavy.ttf font.
Troubleshooting
- CJK text renders as boxes (tofu). The font you picked has no Chinese glyphs. Stick with the bundled Alibaba font, or add a CJK font to your
font_dir. - On Linux/macOS, only one font shows up.
font_dir.inidefaults toC:\Windows\fonts, which doesn't exist off Windows; the plugin falls back to its bundled font. Editfont_dir.inito point at a real font dir (e.g./usr/share/fonts) and restart. - Old saved workflows. The README's own reminder: after a font change, re-select the font in
font_pathfor nodes saved before the change, or the workflow may load with a stale path. - "Why is my size setting ignored?" A connected
mask_imageowns the dimensions. That's by design.
Inputs (24)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| width | INT | 512 | — |
| height | INT | 512 | — |
| scale | FLOAT | 1.000.1–1000 | — |
| margin | INT | 0 | — |
| font_path | COMBO | 1 options: Alibaba-PuHuiTi-Heavy.ttf | |
| min_font_size | INT | 4 | — |
| max_font_size | INT | 128 | — |
| relative_scaling | FLOAT | 0.500.01–1 | — |
| colormap | COMBO | 84 options: viridis, Accent, Blues, BrBG, BuGn, BuPu, +78 | |
| background_color | STRING | #FFFFFF | — |
| transparent_background | BOOLEAN | true | — |
| prefer_horizontal | FLOAT | 0.900–1 | — |
| max_words | INT | 200 | — |
| repeat | BOOLEAN | false | — |
| include_numbers | BOOLEAN | false | — |
| random_state | INT | -1-1–18446744073709550000 | — |
| stopwords | STRING | — | |
| color_ref_imageopt | IMAGE | — | |
| mask_imageopt | IMAGE | — | |
| contour_widthopt | FLOAT | 0.00–9999 | — |
| contour_coloropt | STRING | #000000 | — |
| keynote_wordsopt | STRING | — | |
| keynote_weightopt | INT | 60 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |