
( (computers) % A language that doesn't )Ĭomplex commands can be chained to produce detailed ASCII art such as this Futurama example. Random cow with fortune $ fortune -c | cowthink -f $(find /usr/share/cows -type f | shuf -n 1) The easiest way create a custom cow file is to use an existing one as a template. These files can be edited to the user's liking custom images can also be created from scratch or found on the net. cow text files located in /usr/share/cows, and all themes can be listed with the cowsay -l. emacs - Artist-mode is a built-in package in GNU Emacs that allows you to create simple drawings and diagrams using the Emacs text editor.sl - A steam locomotive runs across your terminal when you type sl as you meant to type ls.tty-clock - A digital clock in ncurses.

#Small ascii art free
TOIlet - Free replacement for the FIGlet utility.nyancat - Renders nyancat in your terminal.neo-matrix - Simulates the digital rain from "The Matrix".jp2a - A small utility for converting JPG and PNG images to ASCII.FIGlet - A program for making large letters out of ordinary text.cmatrix - Animation that plays in terminal based on the text from "The Matrix".catimg - Print images in a terminal with 256 colors support.cbonsai - A bonsai tree generator, written in C using ncurses.boxes - Text mode box and comment drawing filter.bash-pipes - An animated pipes terminal screensaver.Banner - Print large banners to ASCII terminals.Asciiquarium - An aquarium/sea animation in ASCII art.ascii-rain - Comfy rain for your console written in C with Ncurses.the the one above) and with different scales to find out what gives better result. You can play arround with different ramps (e.g. And don't forget about line breaks.Ģ:19 - running the application for the first time to check results in the console.Ģ:33 - the smaller scale is the better results we get. Now we are ready to output every character. Notice that we are dividing the value of "average pixel" by 65536 - this is because Golang's () returns red, green and blue components as 16-bit numbers having 65536 possible values each.
#Small ascii art how to
The funny part is - how to convert grayscale value to an ASCII character? There are some examples of greyscale ramps - you can check more details here.įor example we can use or but I decided to go with even more simple idea is - the darker color is the more "dense" ASCII character should be.

The bigger scaleX and scaleY values the smaller (and with less quality) the resulting ASCII art will be.

Note that we are doing some range checks here to avoid going out of the image boundaries.ġ:47 - now we can just iterate through our image and find average pixel values.īy doing some experiments I came to conclusion that the good ratio is around 2:1 to look nice on terminal screen. It will convert rectangle (x, y) - (x+w, y+h) of image img to grayscale and will find average value of all pixels in this rectangle. That's why we need to group or scale a number of pixels and replace them with one single "average" pixel. For example image 400 by 400 pixels is a rather small image, however you will not find a terminal with 400 colums or 400 rows. Therefore we need to do some type conversion here.ġ:20 - obviously one pixel of a real image cannot be mapped one-to-one to an ASCII character as ASCII character on the screen takes much more space. Note that Golang does not allow to multiply int (or in this case uint32) with float64 constants. There are several ways how to do it and in this case we will use a formula that was used for NTSC analogue television encoding system. Note that we are importing image/png package - this way we instruct Golang which decoder should be used for loading the image.įor consistency we are checking that there are no errors and the image is loaded properly.ġ:07 - define grayscale function that will convert RGB color to a grayscale component. Usually such type of images give best results for ASCII art.Ġ:40 - define loadImage function that will load image from a file system. This image is nice as it has some contrast - some light and dark areas with clear borders. Let's break down the solution and comment on some complex or interesting things.Ġ:20 - As starting point we'll use an image with Golang logo.
#Small ascii art code
Disclaimer: never use this code in production.
