Skip to content

How It Works

Tymur Shashok edited this page Oct 5, 2026 · 1 revision

How It Works

Pipeline

  1. Load: the image is loaded with OpenCV (JPG, PNG, BMP and other formats OpenCV supports).
  2. Resize: the image is resized to 200 × 200 pixels.
  3. Read pixels: for every pixel the R, G and B values are read.
  4. Compute brightness: a value from 0 to 255 is calculated with the standard luminance formula.
  5. Map to a character: the brightness is mapped to an index in the active character set, from dark characters (@, #) to light ones (., space).
  6. Output: the character is printed to the console (colored with the pixel's RGB value in RGB mode) and written to image.txt (always without color).

Brightness formula

brightness = 0.299 · R + 0.587 · G + 0.114 · B

The weights reflect how the human eye perceives each channel: green contributes the most, blue the least.

Character sets

Mode Characters
smallSymb @#*+=-:.
mediumSymb @#W$9876543210?!;:=-,._ (default)
largeSymb @$#WmaOzAdzcfvxrjft/|()1{}[]?-_+~<>i!lI;:,"^'. `

A larger set gives more brightness levels, so more detail and smoother gradients. A smaller set gives a cleaner, higher-contrast look.

Color modes

  • BlackWhite: plain characters, no escape codes.
  • RGB: each character is wrapped in a 24-bit ANSI escape sequence using the pixel's color. Requires a terminal that supports true color.

The saved image.txt is always plain text, regardless of the color mode.

Clone this wiki locally