The project was developed for the ASCII art. For development uses a python language to develop code that reads and converts the image to ASCII

When converting an image to ASCII text it is necessary to follow a few steps:

  • Resize the image to the custom size keeping an aspect ratio
  • Convert the image to grayscale
  • Convert each gray pixel to an ASCII character that has the same intensity as the pixel To build the code that converts an image into ASCII text, it uses the PIL library that reads the image

import PIL.Image Our development consisted of creating functions that make each part of the step

A resize function:

resize_image () One to make the image grayscale

Another to convert each pixel to an ASCII character

```pixels_to_ascii()```
And also a main function where the inputs and function calls are.

The code receives only the image path and returns both a txt file containing the converted image and the text in the terminal itself.

An exemple of ASCII art is (we recommend copying and pasting the following characters into a text editor): Alt text

Base image for prior art:

Alt text

And to assemble the gifs when using a sequence of images we created this java library which can be used by other programs to generate ASCII-art.

There are 3 dependencies:

A python script (thus python): Used to process the input image and generate ASCII-art.
FFmpeg: Used to break videos into multiple images and joining multiple images into a GIF.
wkhtmltoimage: Used to generate images based on HTML.
The install location of this dependencies must be announced to the library. This is done when constructing a class, like this:

File pythonScript = new File("C:\path\To\script.py"); File ffmpegExecutable = File("C:\path\To\wkhtmltoimage.exe"); File wkhtmltoimageExecutable = new File("C:\path\To\ffmpeg.exe");

  DASCIIvinci dasciivinci = new DASCIIvinci(pythonScript, ffmpegExecutable, wkhtmltoimageExecutable);

API
The API is exposed in the class DASCIIvinci.

Java public String generateString(File inputImage); Returns a string that contains the ASCII version of the given image.
Java public void generateImage(File inputImage, File outputImage) Renders the ascii version of an image. The resulting image is saved to a file.
Java public void generateGIF(File inputDir, String pattern, File outputGIF) Renders a GIF, based on the ascii version of all files that follow the given pattern inside a certain folder. The resulting GIF is saved to a file. *The pattern is expected to be given in ffmpeg format.
Java public void breakVideoIntoImages(File inputVideo, int fps, File outputDir, String pattern) Breaks a video into multiple images, following a certain pattern to save them in a certain folder. One must specify the amount of images. *The pattern is expected to be given in ffmpeg format.
Share this project:

Updates