ComfyUI Node

ASCII Generator

ASCII art with a raw text escape hatch

By A043-studios·Created about a year ago·Updated about a year ago· 0
ASCII Generator
  • image
  • ascii_image
  • ascii_text
num_cols100
languagesimple
backgroundblack
font_size12

ASCII Generator is a one-node pack that turns any image into ASCII art - and, unusually, hands you the raw text too. Feed it a render, get back a grayscale character mosaic plus a STRING you can actually copy. If that sounds like a party trick, it is, mostly. But it's a surprisingly useful one for social banners, album-art style thumbnails, or just making your workflow produce something that isn't another photoreal PNG. It's a port of the well-known ASCII-generator library by vietnh1009, wrapped for ComfyUI.

One honest caveat before you commit: the repo is scaffolded by A043-studios' MCP ComfyUI Framework, and it shows. The README's clone URL literally says YOUR_USERNAME in places, and the package metadata credits "MCP ComfyUI Framework" as the author. Don't let that scare you off - the node code itself is complete and functional, just lightly polished around the edges.

How it works

The mechanism is classic brightness-mapping, done right. The node converts your image to grayscale, divides it into a grid of num_cols columns (rows are computed automatically since characters are roughly twice as tall as wide), averages the brightness of each cell, and maps that value onto a character ramp. Dense characters like @ and % stand in for dark areas, spaces and dots for highlights.

The part that's better than the usual naive implementation: it doesn't assume character density - it measures it. Before generating, it renders every character in the active set with Pillow, computes each one's actual brightness, and sorts the ramp accordingly. So simple (@%#*+=-:. ) and complex ($@B%8&WM#*oahkbd...) both map correctly regardless of your font.

Inputs and outputs that matter

Five required inputs, and you only really fiddle with three:

  • num_cols (10–500, default 100) - the horizontal resolution of the art. Higher = more detail, and the output image gets wider. This is the main "how much does it look like the original" dial.
  • language - the character ramp. simple is the classic 70s-terminal look and what you'll want for most things. complex gives finer tonal gradients. The rest (english, chinese, korean, japanese, russian, german) swap in alphabet characters for a stylized effect - fun on a portrait, illegible at a distance.
  • background (black/white) - the output image's background, with the text color inverted to match. Default black, which looks right for the aesthetic.
  • image - any IMAGE tensor. font_size (6–48) affects the rendered output image, not the text.

It returns two outputs: ascii_image (an IMAGE you can send to a Preview or Save node) and ascii_text (a STRING). Wire the text into any text-output node and you can copy-paste the art into a README, a Discord message, or a terminal where it'll actually be monospaced and look right. That's the sleeper feature - most ASCII tools only give you the picture.

Installing it

No models, no heavy dependencies. The only requirements are torch, numpy, and Pillow, all of which ComfyUI already has, so there's nothing extra to download.

The easy way: ComfyUI Manager → search "ASCII Generator" → install, then restart. Manually, from your ComfyUI directory:

cd custom_nodes
git clone https://github.com/A043-studios/Comfyui-ascii-generator

then restart ComfyUI. Ignore the README's manual-install instructions - they point at a placeholder URL, which is exactly the kind of scaffolding rot mentioned above. The real repo is the one in the pack URL.

Gotchas

  • CJK and Cyrillic glyphs may render as boxes. The code tries to load arial.ttf; on Linux that usually doesn't exist, so it falls back to Pillow's default bitmap font, which has no CJK or Cyrillic glyphs. You'll get tofu rectangles instead of and friends. Pick those language modes knowing they may be a blank grid on your setup.
  • Batch processing is a polite fiction. Despite the README's claim, the code grabs image[0] and ignores the rest of the batch. Fine for single images; just don't feed it a batch and expect a movie.
  • Failures are quiet. If anything throws, the node returns a black 512×512 image and a string that literally starts with Error:. If your output looks wrong and the text is an error message, that's the tell - check the ascii_text output, not the image.

For its niche - decorative, low-stakes output - it works, costs nothing, and installs in seconds. Just don't expect it to replace your upscaler.

Categoryimage/ascii

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
num_colsINT10010–500
languageCOMBOsimple8 options: simple, complex, english, chinese, korean, japanese, +2
backgroundCOMBOblack2 options: black, white
font_sizeINT126–48

Outputs (2)

NameTypeDescription
ascii_imageIMAGE
ascii_textSTRING