ASCII Art Generator
- 9 Devlogs
- 11 Total hours
A CLI tool to generate ASCII art from image files
A CLI tool to generate ASCII art from image files
Added a features list to the README, and added an asciinema demo to the project page. Also created release on Github so that precompiled binaries can be downloaded easily. The asciinema demo is accessible through the release page on github, or by going to https://asciinema.org/a/1259289
Added custom palette support, so now you can specify a string of characters from dark to light and it will be used to create the output ASCII image. Also created a README file, which can be seen on the project info
Added an edge detection filter by using the Sobel filter. In future I may use this for using characters to make defined edges, but for now edges are just highlighted. Here is an example: Top is without filter, bottom is with filter. The filter does start to fall apart at low resolutions due to simply not enough detail
Added the option to output to a file instead of just to the console, by using the -f or --file argument
Added a help function. When created, each argument now specifies a description, and the help function prints out all flags and descriptions
Implemented contrast and saturation arguments, and changed brightness to use HSV. Also code cleanup and fixing some pixels being above 255, causing them to overflow. Image below shows brightness and contrast, but as it is a black and white gradient, I didn’t show saturation (there would be no change).
Refactored the argument system so that different value types are derived classes from the base Argument class. While I was doing this, I also included some better error handling for incorrect / missing argument values, seen here:
Images now can be crudely converted to text. The program first scales down the image to the desired size, then calculates the luminance of each pixel and looks up the corresponding symbol for that level of brightness, with @ being the darkest and being the lightest, although this palette can easily be changed in code. The top image is a black to white gradient and the bottom is a test of the alpha channel. My next goals are to change the argument class to have different child classes based on value type and allow associated functions. I want to also implement basic terminal colouring, allow contrast control, allow edge detection and custom palettes.
Took me a while, mainly because I was also testing image processing libraries, but I have implemented a basic argument system. Currently there is only height and width, as well as verifying filepath for the source image, which is always first. They can have 2 flags, normal and alternate, and can have an integer attached or not, and can be put in any order after the filepath. Next thing to do is take the input image, resize and loop through all pixels, calculating brightness.