Convert Video or Image to ASCII Art

Portfolio und Leben

Convert Video or Image to ASCII Art

Convert Videos to ASCII with Python Example

What is it?

Convert Videos to ASCII with Python with this script. It can convert a video or image file to a video or image made of ASCII characters.

How does it work?

  • It calculates the average brightness of pixels from each frame and chooses an according character
  • A bright pixel could be represented with“.“, and a dark one with „W“

How to run?

  • Install libraries
  • Run with python

Libraries

  • Update pip
$ pip install --upgrade pip
  • Install the following libraries in your terminal:
$ pip install tk
$ pip install opencv-python
$ pip install progress

Run with python

  • Unpack zip, if you haven’t already
  • From your terminal: navigate to „videoToAscii“ folder
  • Run command
$ python3 main.py
  • Enter resolution (width) in characters → default is 150 characters
  • Select if you want compression
  • The finished file will be saved as .html under „videoToAscii/file-to-text“, which you can run in your favored web browser

Keep in mind!

  • This program does not contain a „good“ compression algorithm, there is a chance of getting a larger output file if you choose to compress it.
  • If the file you want to convert contains a lot of same-colored pixels, i.e. a picture of the moon which is mostly black, the compression may work.
  • I might add a suitable algorithm later 🙂
  • Thanks for trying my program 🙂 David – Nov 2022

Look at my other projects!

If you found this article interesting, you might be interested in some of my other projects. Follow up on python scripts, like my wallpaper slicer, or take a look at some of my JavaScript applications like Snake or Minesweeper

Tags: , , ,

2 Antworten

  1. […] the Monty Hall problem, or take a look at some of my python scripts like my wallpaper slicer or a video to ASCII conversion […]

  2. […] the Monty Hall problem, or take a look at some of my python scripts like my wallpaper slicer or a video to ASCII conversion […]

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert