[Book Tools] Random Text Overlay
A sticker machine that drops your text in a random spot
- image
- IMAGE
BTRandomTextOverlay is the "sticker" node of the Book Tools pack. Where BTImageTextOverlay puts text in a fixed box with mechanical precision, this one slaps your text onto a rounded, semi-transparent white chip and drops it in a random corner of the image. It's the node you reach for when you want a casual label, a badge, a watermark, or a "chapter note" look - text that feels placed by hand rather than typeset.
How it works
It takes an image and text, wraps the words to fit the image width (minus margin and padding), then makes two random choices: position (top or bottom) and alignment (left or center). It draws a white rounded rectangle behind the text - the corner rounding comes from corner_radius, the inset from margin - and renders your text on top with a faint white copy behind it for legibility. The result is composited back onto your image and returned as a single IMAGE.
The inputs worth touching as a beginner:
font_size- fixed, unlike the auto-fit nodes. There's no binary search here; if your text is long, it wraps to more lines.color- hex string like#000000for the text.corner_radius- how rounded the chip is; 0 gives a hard rectangle.marginandpadding- distance from the image edge and room inside the chip.line_height_factor- line spacing, 1.2 default.
The randomness caveat that will confuse you
"Random" here is drawn from Python's random module - there's no seed input. And because the node doesn't define an IS_CHANGED method, ComfyUI caches its output whenever the inputs are identical. Net effect: the sticker doesn't actually move to a new spot on every queue run. It picks a new position when something upstream changes (or when you clear the cache), then stays put. If you want it genuinely re-randomized every run, you need an upstream node that changes each pass - or you'll think the node is broken when it isn't.
The usual font path
font defaults to /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf, a Linux path that doesn't exist on Windows - in which case the node falls back to PIL's tiny built-in font and your text renders cramped. Point it at a real font file, or use BTDownloadFont (same pack) to fetch one and paste its path in.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/Big-Idea-Technology/ComfyUI-Book-Tools
# restart ComfyUI
Or search "ComfyUI-Book-Tools" in ComfyUI Manager. No models, no extra pip dependencies - Pillow does all the work.
Where it fits
The Book Tools family is about laying out books, and this is the "editor's note" node - annotations, pull quotes, chapter badges that shouldn't look machine-aligned. If you need determinism, use BTImageTextOverlay; if you want organic placement and don't need reproducibility, this one's a pleasant alternative to hand-positioning text on every page.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| text | STRING | Hello | — |
| font_size | INT | 308–100 | — |
| font | STRING | /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf | — |
| color | STRING | #000000 | — |
| padding | INT | 20 | — |
| margin | INT | 20 | — |
| corner_radius | INT | 15 | — |
| line_height_factor | FLOAT | 1.20.5–3 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |