FLXCode Image to ASCII Art

FLXCode apps

Appearance

Image to ASCII Art

Open a picture and get it back as text. Copy it into a post or a file, or save the text drawn as a picture.

or drop it here, or paste with Ctrl+V

JPG, PNG, WebP, HEIC, AVIF, GIF and BMP, up to 25 megapixels. Nothing is uploaded.

Works offline: load this page, edit one picture, turn off Wi-Fi, edit more. A JPG has no see-through areas, so they turn white.

Nothing you open or type is uploaded. How we count What this tool keeps and sends.

Problem or idea? Email us

How to turn a picture into text

  1. Choose a picture, or drop or paste one. It stays in this tab.
  2. Set Characters per line. Fewer characters suit a small screen, more shows detail.
  3. Pick the characters. If your text goes on a dark page, switch to Light on dark, or the picture comes out as a negative.
  4. Copy the text, save it as TXT, or save the picture of it as PNG or JPG.

How a picture becomes characters

The picture is cut into a grid. Characters are about twice as tall as wide, so the number of rows is the number of columns times H ÷ W, halved. Every cell takes the average of its pixels.

Brightness of a cell is L = 0.2126 R + 0.7152 G + 0.0722 B, the Rec. 709 weights, from 0 to 255. See-through pixels count as the page colour. For dark text on a light page the density is 1 − L ÷ 255: dark cells get dense characters. For light text it is L ÷ 255.

Contrast bends the density around 0.5. Then the character is number floor(density × n) of a ramp with n characters, from the emptiest to the densest, and never more than n − 1. A ramp of two characters gives only space and #.

The picture version draws each character from a small built-in bitmap, so it looks the same on every device. The text version uses your own font, so spacing there depends on it.

rows = ⌊(cols × H + W) / (2 W)⌋

L = mean of 0.2126 R + 0.7152 G + 0.0722 B (cell)

density = 1 − L / 255 (light text: L / 255)

d′ = clamp((density − 0.5) × contrast + 0.5, 0, 1)

index = min(n − 1, ⌊d′ × n⌋)

From grey to character, ten steps

Dark text on a light page, ramp ". : - = + * # % @" with a space first, contrast 100%. Numbers from the same code as the tool.

Grey (L)DensityIndex 0 to 9Character
01.0009@
640.7497#
1280.4984=
1920.2472:
2550.0000space

A pure white cell has density 0 and gets a space, so white areas stay empty in the text.

The same five greys with each character set

Dark on light, except the last column: light text on a dark page, which turns the order around.

Grey (L)Ten stepsFive stepsTwoShade blocksTen, light on dark
0@@#█space
64###▓:
128=+space▒+
192:.space░#
255spacespacespacespace@

What this does not do

  • The text only looks right in a font where every character is the same width, such as a code font. In a normal font the picture falls apart.
  • At most 160 characters per line and 120 lines. More would not fit on a screen, and long lines wrap in many apps.
  • Fine detail is lost. Thin lines and small text in a picture usually vanish, because a cell is the average of many pixels.
  • The coloured picture only colours the characters. The text version has no colour, and there is no HTML or ANSI colour output.
  • The shade block characters need a font that has them. Some forums show them as boxes.

Next: resize the saved picture · read words from a picture instead

FAQ

Why is my ASCII art stretched?

Characters are taller than wide, so the tool uses about half as many lines as columns. If the font you paste into is nearly square the art looks too tall. Use a code font.

How wide should it be for a forum post or a chat?

Eighty is the classic terminal width and fits most code boxes. On a phone try 40 to 60. A line that wraps breaks the whole picture.

Why does it look like a negative in my terminal?

The tool counts dark text on a light page. A black terminal needs Light on dark, so the bright parts of the photo get the dense characters.

Can it give me colour in the text?

No. Colour only shows in the saved picture, where each character takes the average colour of its cell. The copied text has none.

Which characters are used?

Four sets: ten steps from space to @, five steps, two (space and #), and four shade blocks plus a full block. They are chosen by how much ink the character has, not by a standard.

More from FLXCode

  • Image to TextCopy text from a screenshot, photo or scan. English OCR that runs on your device. Nothing is uploaded.
  • Image ResizerResize photos by pixels, percent or preset for Instagram and email. Batch and zip. Nothing is uploaded.
  • Compress ImageCompress JPG, PNG and WebP by quality or target KB, with a side-by-side preview. Nothing is uploaded.
  • Change Image ColorSwap one colour in a picture, or shift the colours of the whole thing. Nothing is uploaded.

Share Image to ASCII Art