How to Convert JPG and PNG Images into ASCII Text Art

A JPG photograph and a PNG illustration can both become ASCII text art: the converter reduces the picture to a grid and replaces each part with a character based on its brightness. The resulting artwork can be copied into a text editor, terminal, code comment, or message.

The main difference is how you prepare the source. JPG files are commonly photographs, often with soft tonal transitions and compression artifacts. PNG files frequently contain logos, screenshots, line art, or transparency. Those differences affect which settings produce a readable conversion.

Convert a JPG or PNG to ASCII Text Online

For a quick conversion, choose an image-to-ASCII tool that supports your file type and lets you copy the text result.

  1. Select your source image. Upload a .jpg, .jpeg, or .png file.
  2. Set the background. If a PNG has transparent areas, preview it against a light or dark background rather than leaving its appearance to chance.
  3. Choose the output width. Start with roughly 60–100 characters across for a general-purpose text drawing.
  4. Pick a character style. A detailed grayscale-style set may suit photographs; a short, high-contrast set often suits icons and logos.
  5. Keep proportions correct. Enable automatic aspect-ratio adjustment when offered.
  6. Copy or download the text. Use a plain .txt file when the artwork must remain editable.

Before sharing the output, paste it into a monospace text editor. If the image looks broken there, fix the conversion. If it only looks broken in a chat app, the issue may be formatting rather than image quality.

JPG Versus PNG: Which Is Better for ASCII Conversion?

Source propertyJPG / JPEGPNG
Typical contentPhotographs and realistic imageryIcons, logos, screenshots, graphics, and photos
CompressionLossyLossless
Transparency supportNoYes, in supported PNG color modes
Potential issueCompression blocks or halos around detailsTransparent pixels blending with an unexpected background
Good first character setGradual dark-to-light symbolsSimple symbols for bold shapes

A PNG is not automatically better than a JPG for every ASCII drawing. The composition and contrast of the picture usually matter more than its filename. Converting an already compressed photo to PNG cannot reconstruct details lost in the earlier JPG compression.

Handle transparent PNGs before converting

Consider a black logo stored on a transparent canvas. If the converter displays transparent pixels against black, the logo can disappear. If it places the same logo on white, the shape may become obvious.

When possible, select a background color that contrasts with the subject. Some converters let you change it directly; otherwise, flatten the transparent image onto a solid background in an image editor before uploading.

Improve noisy JPG photographs

Highly compressed JPG images can contain visible artifacts near sharp edges. Those patterns may turn into unwanted punctuation in the ASCII result. Try using a cleaner source photograph, cropping tightly, or slightly simplifying the image before conversion. Avoid pushing sharpening and contrast so far that compression noise becomes the dominant texture.

Convert JPG and PNG to ASCII Using Python

If you want an offline, repeatable workflow, Python and the Pillow imaging library can generate plain ASCII text. Install Pillow in your Python environment:

python -m pip install Pillow

Save the following as image_to_ascii.py:

from pathlib import Path
import sys
from PIL import Image, ImageOps

RAMP = "@%#*+=-:. "  # Darkest to lightest
WIDTH = 80

source = Path(sys.argv[1])
image = ImageOps.exif_transpose(Image.open(source)).convert("RGBA")

# Put transparent PNG artwork on a white background.
background = Image.new("RGBA", image.size, "white")
image = Image.alpha_composite(background, image).convert("L")

# Approximate the shape of a typical terminal character cell.
height = max(1, round(image.height / image.width * WIDTH * 0.55))
image = image.resize((WIDTH, height), Image.Resampling.LANCZOS)

pixels = list(image.getdata())
lines = []
for row in range(height):
    values = pixels[row * WIDTH : (row + 1) * WIDTH]
    lines.append("".join(RAMP[v * (len(RAMP) - 1) // 255] for v in values))

output = "\n".join(lines)
source.with_suffix(".txt").write_text(output + "\n", encoding="utf-8")
print(output)

Run it with a filename:

python image_to_ascii.py photo.jpg
python image_to_ascii.py icon.png

The script keeps the original pixel proportions approximately, compensates for typical character dimensions, and saves the generated art alongside the source as a .txt file. Change WIDTH or RAMP to experiment. The 0.55 character-height adjustment is a starting approximation, not a universal setting for every font.

What Happens to the Image's Colors?

In plain monochrome ASCII, color becomes brightness. A vivid red object and a green object can map to similar-looking text if they have similar perceived lightness. That is normal: the text represents light and dark areas, not full color channels.

Some converters offer colored HTML, ANSI terminal output, or image exports. These add rendering information around or behind the characters. A basic .txt file cannot store the original per-character color treatment by itself.

How to Use the Resulting ASCII Text

A .txt export is useful when you need an editable file. Open it in an editor, replace characters, trim unwanted rows, or combine several drawings. You can place the result inside a Markdown code block for a README or send it in a code block on Discord.

If the destination changes the font, trims spaces, or wraps long lines, consider a narrow text version or an image export instead. ASCII conversion and ASCII display are separate problems; both must work for the final picture to look right.

Conclusion

Converting JPG and PNG images into ASCII text art follows the same general method, but the best preparation differs. Give JPG photographs clean contrast and enough room for tonal detail. For PNG graphics, pay special attention to transparency and edges. Whether you use an online tool or Python, choose a readable width, preserve the character grid, and save plain text if editability is the goal.

Frequently Asked Questions

Can I convert a transparent PNG into ASCII art?

Yes. A converter must decide how to treat transparent areas. Placing the PNG on a solid background before measuring brightness is a dependable method. Choose a background that contrasts with the visible subject; otherwise, a dark logo may disappear into the background or become difficult to recognize.

Does converting JPG to PNG improve ASCII quality?

Not by itself. Saving a JPG as PNG prevents additional loss from that new file's compression, but it cannot restore fine details already discarded from the original JPG. Better cropping, contrast, and output width usually make a bigger difference to the ASCII result.

Can I save an ASCII conversion as a TXT file?

Yes. A TXT file preserves the characters and line breaks and is a good choice for later editing. Open it with a monospace font to maintain the drawing's layout. If you need colors and fixed appearance, use an image or another format that carries styling information.

Is an image-to-ASCII converter the same as OCR?

No. Optical character recognition tries to read letters or words present in a picture. Image-to-ASCII conversion redraws the entire picture using text symbols. The resulting characters usually describe visual shapes and shadows rather than transcribing actual words from the image.