dorkhub

ImageToAscii

Python tools for Image Ascii Art.

cleardusk
Python524 forksMITupdated 7 years ago
git clone https://github.com/cleardusk/ImageToAscii.gitcleardusk/ImageToAscii

Intro

This is a simple, light and optimized image-to-ascii and ascii-to-image converter. It now supports image and video.

1. Image to Ascii

This conversion is implemented by mapping the intensity of pixel to characters with different shape.

Command option

-f | --file is input image path.

-s | --scale controls the output size.

-a | --aspect controls the aspect of height and width.

-w | --write-file is the output ascii txt path.

Usage

# lazy style: the default output is ${img_file}.txt
python img_to_ascii.py -f imgs/erke.jpg

# adjust sampling step, the output is larger if it is samller
python img_to_ascii.py -f imgs/erke.jpg -s 2

# complete style
python img_to_ascii.py -f imgs/erke.jpg -s "auto" -w out.txt

Samples

Notes

You can adjust the font size of text editor for better view.

2. Ascii to Image

It calls the text drawing API of PIL to implement the rendering of ascii text to image.

python ascii_to_img.py -f imgs/kenan.txt -w imgs/kenan_ascii.jpg

3. Video conversion

python ascii_art.py -f videos/kenan.mp4 -s 1 -e 360 -w res/kenan.gif -p 10 --step=10 --scale=0.25 --sampling-step=6

More videos to see BaiduYun.

more like this

thorn

a pure lazy functional programming language to make ASCII art animations (and other things too)

Rust50

meine

meine 🌒 - A CLI file manager and system utility built with Textual. It combines intuitive command parsing with rich t…

Python50

search

search projects, people, and tags