Nodes/ComfyUI-Image-Effects/๐Ÿ“ ASCII Text Generator
ComfyUI Node

๐Ÿ“ ASCII Text Generator

Get Your Image Back as Actual Text You Can Paste Into a README

By orion4dยทCreated about a year agoยทUpdated about a year agoยท 28
๐Ÿ“ ASCII Text Generator
  • image
  • ascii_text
โ—„ascii_width80โ–บ
โ—„styleclassicโ–บ
โ—„invertfalseโ–บ
โ—„contrast_boost2.0โ–บ
โ—„height_compression2.0โ–บ
โ—„custom_chars .-+*#@โ–บ
โ—„add_borderfalseโ–บ
โ—„line_numbersfalseโ–บ

ASCII Text Generator is the pack's weird-but-useful outlier: it converts your image into ASCII art and hands it to you as a STRING, not an image. The output socket is plain text - copy it out of ComfyUI and paste it into a forum signature, a README, a terminal, or an email, and it renders as character art wherever monospace fonts live. The sibling ASCII Art Generator does the same conversion but draws it back into an IMAGE; this one is for when you actually want the raw text.

It's a rare case in ComfyUI where a node's whole job is to get data out of the graph as text. It's marked as an output node, so it shows its result in the UI - you can read the art right there in the node.

How it works

Same core algorithm as the ASCII Art Generator: grayscale conversion, downsizing to an ascii_width grid with height_compression to correct for character aspect ratio, a contrast-boost pass before mapping, and then a brightnessโ†’character lookup. The differences are the extras aimed at text output. It supports a custom_chars ramp (default " .-+*#@"), so you can define your own character set left-to-right from darkest to lightest - which is the one real reason to pick this node over its sibling. There are also add_border and line_numbers toggles for wrapping the output in a +--+ box with row numbers, which is oddly delightful for "generated source" aesthetics.

Styles match the sibling: classic, detailed (block chars), minimal, blocks (Unicode block elements), plus custom which uses your custom_chars ramp.

The inputs that matter

  • ascii_width (20โ€“200, default 80) - characters per line. 80 is the classic terminal width.
  • style - including custom for your own character ramp.
  • custom_chars - your ramp, dark-to-light. Try " โ–‘โ–’โ–“โ–ˆ" for a chunkier look.
  • invert - flip which characters mean light vs dark.
  • add_border / line_numbers - formatting extras for the pasted result.
  • contrast_boost (1โ€“4, default 2) and height_compression (1โ€“3, default 2) - same as the sibling; nudge contrast if the art is muddy.

Output is a single STRING named ascii_text. Because it's an output node, you can't meaningfully chain it further - it's the end of the line by design.

Installing it

Part of ComfyUI-Image-Effects (Orion4D). ComfyUI Manager โ†’ search "Image Effects", or:

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

Restart, then it's under Add Node โ†’ Image Effects. No models - the whole thing runs on NumPy and Pillow.

Gotchas

Same pack-wide note: only the first image of a batch is converted, so don't feed it a frame stack expecting per-frame text. The honest limitation is that pasted text art only looks right at a terminal's aspect ratio - the height_compression default of 2 exists because characters are about twice as tall as they are wide, so leave it alone unless your paste target is unusual. And heads-up: it doesn't print the text to the ComfyUI console - the result lives in the node's string output and the UI display, so read it there.

CategoryImage Effects

Inputs (9)

NameTypeDefaultDescription
imageIMAGEโ€”
ascii_widthINT8020โ€“200โ€”
styleCOMBOclassic5 options: classic, detailed, minimal, blocks, custom
invertBOOLEANfalseโ€”
contrast_boostoptFLOAT2.01โ€“4โ€”
height_compressionoptFLOAT2.01โ€“3โ€”
custom_charsoptSTRING .-+*#@โ€”
add_borderoptBOOLEANfalseโ€”
line_numbersoptBOOLEANfalseโ€”

Outputs (1)

NameTypeDescription
ascii_textSTRINGโ€”