ASCII Art Generator (Static):
ASCIIArtGenerator turns an image into a picture made from text characters. It reduces the image to a grid, measures the brightness of each part, and chooses a character for each position. It then draws those characters as an image and resizes the result to the original image’s dimensions. This lets you create a typographic version of an image while keeping it compatible with an image-based workflow. The result is a rendered picture, not editable text.
ASCII Art Generator (Static) Input Parameters:
image
The source IMAGE to convert. The node uses the first image if a batch is supplied. It reads the image’s brightness to select characters and uses its width and height for the final result. There is no default, minimum, or maximum specified for this input.
char_width
The number of character positions across each line of the artwork. A higher value can preserve more detail, but it also creates more characters to process and may look crowded when the result is resized. A lower value produces larger, more recognizable characters and a more abstract image. Default: 100; minimum: 10; maximum: 2000; slider step: 10. The number of lines is calculated from this value and the source image’s proportions, with an adjustment for typical character shapes.
font_path
The path or font name used to draw the characters. The default is cour.ttf. A font with consistently sized characters is useful when you want an even-looking grid; a different font can change the artwork’s appearance and spacing. There is no specified minimum or maximum. If the font cannot be opened, the node prints a warning and attempts to use Pillow’s default font instead.
font_size
The size of the font used when the character artwork is first drawn. Larger values produce a larger intermediate image; smaller values produce a smaller one. The node then resizes that artwork to match the source image, so this setting can affect the appearance of the characters even though it does not change the final image dimensions. Default: 15; minimum: 5; maximum: 100; slider step: 1.
ascii_charset
The ordered characters available for representing brightness. The first character is chosen for the darkest areas and the last for the brightest areas, unless brightness mapping is inverted. The default sequence starts with a space and progresses through punctuation, letters, and denser symbols: .'`^":;Il!i~_?[{1(|/fjxnvzXYJCLQ0Zmwqdkh*#M&8%B@$. There is no specified length limit, but it cannot be empty. Changing the order changes which marks appear in shadows and highlights; using fewer characters creates a simpler result.
background_color
The color behind the drawn characters. Default: #000000 (black). The node passes this string to Pillow’s color parser, so it must be a color that Pillow recognizes; no minimum or maximum is specified. If either color setting is invalid, the node prints a warning and uses black for the background and white for the text.
text_color
The color of the drawn characters. Default: #FFFFFF (white). Choose a color that contrasts with the background so the shapes remain visible, especially after the final resize. The string must be recognized by Pillow’s color parser; no minimum or maximum is specified. An invalid value in either color setting makes the node use black background and white text.
invert_brightness_mapping
Switches which end of the character sequence represents dark and bright areas. Default: False. With False, dark areas use characters near the beginning of the sequence and bright areas use characters near the end. With True, that relationship is reversed. This changes character selection; it does not swap the text and background colors.
ASCII Art Generator (Static) Output Parameters:
ascii_image
The resulting IMAGE containing the rendered character artwork. It has the same width and height as the first input image, making it straightforward to pass into later image nodes. Its pixels contain the chosen text and background colors; it is not a text file or a copyable block of ASCII characters. The node returns one image even when the input contains a batch.
ASCII Art Generator (Static) Usage Tips:
- Start with the default charset, then adjust
char_widthto find the right level of detail. Lower values work well for a bold, simplified look; higher values retain more of the source image’s structure but require more processing. - Keep the characters in your custom
ascii_charsetordered by the visual effect you want from dark to bright. If the pattern appears opposite to your intention, tryinvert_brightness_mappingbefore rebuilding the sequence. - Use clearly contrasting
text_colorandbackground_colorvalues. Low contrast can make the character shapes difficult to see after resizing. - Check that
font_pathpoints to a font available in your environment. If the result looks unexpectedly different, look for the font-fallback warning and correct the path. - Begin with a moderate
char_widthand increase it gradually for large images. The node measures and draws every generated line, so very dense settings can take longer and use more memory. - Supply the image you intend to process first in a batch: this node reads only the first image.
ASCII Art Generator (Static) Common Errors and Solutions:
ValueError: ASCII charset cannot be empty.
- Explanation: The
ascii_charsetfield has no characters, so the node cannot choose a symbol for any image area. - Solution: Restore the default charset or enter at least one character. For visible variation between dark and bright areas, use multiple characters in the order you want them selected.
Warning: Font '...' not found. Falling back to default PIL font.
- Explanation: The node could not open the font specified by
font_pathand is attempting to use Pillow’s default font. This is a printed warning, not necessarily a failed run. - Solution: Check the font name or path and confirm the font file is available where the node runs. If the output still renders, you can also keep the fallback font if its appearance suits your artwork.
Warning: Invalid color string. Using black background and white text.
- Explanation: Pillow could not interpret
background_colorortext_color. Because the node parses them together, one invalid value causes both colors to revert to black and white. This is a printed warning, not necessarily a failed run. - Solution: Check both fields and try unambiguous values such as
#000000and#FFFFFF.
Pillow image or shape error while converting image
- Explanation: The node converts the first supplied image into a Pillow image before making the character grid. An image tensor with an unexpected shape or channel arrangement may not be convertible by the code shown.
- Solution: Feed the node a standard IMAGE from your workflow and check any preceding node that changes image dimensions or channels.
Memory error or very slow execution
- Explanation: A large source image or a high
char_widthcan produce many characters to measure, draw, and resize. - Solution: Reduce
char_widthfirst. If the result is still too slow or memory-intensive, use a smaller source image before this node.
