Jitac 0.3.0 - Image To ASCII ConverterCopyright © 2001, 2002 by Konrad Rieck
Jitac is an image to ASCII converter written in Java. Yes, you guessed right, this is a cute console application that converts high-quality images into oldschool ASCII art. If you find this idea ridiculous, well, better don't read on.
Jitac reads a source image that can have one of the following formats: GIF, JPEG, TIFF, PNG, PICT, Photoshop, BMP, Targa, ICO, CUR, Sunraster, XBM, XPM and PCX. Jitac also reads in a font which can be chosen from a list of integrated fonts or loaded from a BDF font file. The result of the image to ASCII conversion strongly depends on the chosen font. Images rendered with a font and displayed with another font may look really weird.
Before the conversion some filters and optional features can be applied to the source image, e.g. inversion, re-sizing/scaling, gamma correction. The conversion is done by dividing the image into blocks that have equal size and whose dimensions match the character dimensions. For each block the character is chosen that best matches the pixels inside the block. Features such as noise or rounding (often used in neural networks) can be used to improve conversion quality.
By default Jitac uses all visible ASCII characters in the range 32-126, but Jitac also allows using different ranges or even a specified set of characters for converting an image, e.g. the set " .o0O".
Jitac has been written by Konrad Rieck. Jitac requires an installation of JIMI, the Java Image Manipulation Interface. Jitac is licensed under the GNU General Public License Version 3 (GNU GPLv3).
Actually there is no big kind of installation, just copy the Jitac Jar to a directory. Additionally, you may need to adapt your classpath to point to the installation of JIMI. You can then execute Jitac by running the following command in this directory:
$ java -jar jitac-VERSION.jarwhere VERSION is the version of Jitac you downloaded.
Jitac comes with a README file inside the Jar Archive, you can display the file by running the following command
$ java -jar jitac-0.1.1.jar -RYou can also read the README file here. A short description of all command line options can be displayed by running:
$ java -jar jitac-0.1.1.jar -hFor more details refer to the README and see the following examples.
A simple example
$ java -jar jitac-0.2.0.jar -w 60 -o slumb.asc slumb.gif
The image was converted using Jitac "out-of-the-box", no special options were needed.
$ java -jar jitac-0.2.0.jar -o gradients.asc gradients.gifNoise 0.37
$ java -jar jitac-0.2.0.jar -n 0.37 -o gradients.asc gradients.gifWorking with photos or images that have fine granulated gradients is more difficult. In normal mode Jitac finds the character that best matches a given block of the image. This is done by interpreting the block and all characters as vectors and computing the Euclidean distance between the block and all characters. The character with the smallest distance is chosen as a representative of the block.
Due to the fact that characters are black and white images, gradients are badly converted because the white space character often has the smallest distance to the blocks. In order to avoid this behaviour, Jitac uses a trick, that is used in most neural network algorithms. It can add a specified noise to the characters. Calculating the distance now gives better results.
The first image shows the source, the second a conversion with no noise, and the third a conversion with noise 0.37 (37% noise in characters).
HTML and color conversionHTML conversion
$ java -jar jitac-0.2.0.jar -H -o izab.html izab.jpgHTML conversion with color
$ java -jar jitac-0.2.0.jar -C -o izab.html izab.jpgHTML conversion with color, only blue and green channel
$ java -jar jitac-0.2.0.jar -c 6 -C -o izab.html izab.jpgSince version 0.2 Jitac is able to convert images into HTML pages by adjusting the characters, e.g. escaping > and < and by adding a simple header and footer to the output.
The images to the right show how color mask filtering improves the output result. The image at the right most has been converted using a blue input color channel mask.
It's quality is even better than the image converted with all input color channels due to the fact that a blue channel mask improves red and green colors in the result if no output color channel mask is used.
$ java -jar jitac-0.2.0.jar -w 70 -f fixed05x07 -n 0.25 -o gumbrecht.asc gumbrecht.jpg