ascii_py is a cool python cli program that takes you images and makes cool looking ascii art out of them, find the github repo, installing ascii_py is very easy, just install python3 and run a simple pip command:
python3 -m pip install ascii_py
there is also compiled linux binary on the repo here
everything is downloaded from a royalty free image website here and some royalty free stock footage from youtube
Flag | Description |
---|---|
-o , --out |
the filename you want your final image saved as |
-w , --words |
use words to create your image |
-s , --step |
choose the distance of your characters |
-d , --density |
converts the image based on visual density |
-t , --terminal |
print ascii image to terminal |
-h , --help |
show help message and exit |
ascii_py basketball.jpg -o b-ball.jpg
use a wide range of characters to show density of the picture, this is the best option this program has imo
ascii_py men.jpg -d -o workers.jpg
ascii_py ab4.jpg -d -o abstract.jpg
ascii_py bicycle.jpg -d -s 10 -o bicy.jpg
ascii_py harleyD.jpg -d -s 15 -o harlD.jpg
this option takes your characters and use it to draw the picture, it’s not a randomized or image based options tho, it repeats everything you add to it, spaces are empty characters in the image. so we either want to pass one character only to fill the whole image with it or add certain strings to replicate the effect.
ascii_py ab7.jpg -w "/" -s 5 -o abst+.jpg
ascii_py sunset.jpg -w "\|/-_" -s 5 -o sun+.jpg
sometimes we want to make an animated gif but we only have one image to work with, if the program applies random values to conversions we would just feed the same image many times to make animated gifs but in the case of this progam that does not seem to be the case.
we still have the option to modify our image somehow so the program see’s it differently, lets apply that logic to an image and convert it to different resoulotions
for i in {500..1500..50} ; ffmpeg -i cloud.jpg -vf scale=$i:-1 C-$i.jpg
what we did above is we started at 500 height and every frame added 50 to that to get to the 1500 frame in the 30th file, now let’s feed these to ascii_fy
for i in *.jpg ; do ascii_py music.jpg -d -o B-$i.jpg ; done
the name of each file is added to to B- to make the name of our output image, now let’s resize all of our images to 1280 width so ffmpeg does not compress everything to the lowest common denomitor
for i in B-*.jpg ; do ffmpeg -i $i -vf scale=1280:280 C-$i.jpg ; done
notice that every time we convert these images we append differnt words for them, this is done for the case of easily cating them for conversion which is our last part
ls -v *.jpg | xargs cat | ffmpeg -framerate 10 -f image2pipe -i - cloud.mp4
we use ls to pipe file names to cat because we have 3 and 4 digit names in our images and if we only used cat the order would have not been numerical
you can also randomize file names to make this gif file less uniform
for file in *.jpg ; do mv -- "$file" "$(mktemp --dry-run XXXXXX.jpg)" ; done
lets apply what we learned to a video, i have made a example of how to download a free video, make image sequence, apply filter and mux it back here
for i in *.jpg ; do ascii_py $i -d -o A-$i ; done
and mux them to a video, note we also apply compression to this video to avoid very large outpot size, without any compression the output size would be 150_mb, with the default ffmpeg compression it would have been 23_mb but we force bitrate to stay at 8mb and use veryslow preset to retain as much details as we can and end up with a 6.6_mb file that looks very similar to the uncompressed file
cat A-image-00* | ffmpeg -framerate 30 -f image2pipe -i - -b:v 8M -preset veryslow ascii_run.mp4