You are browsing as a guest. Sign up (or log in) to start making projects!

ASCII Art Generator

  • 9 Devlogs
  • 11 Total hours

A CLI tool to generate ASCII art from image files

Ship #1

I’ve made CLI program used to generate ASCII art from image files.
I’m quite proud of all of the customisable options I included, from image size, brightness, contrast, saturation and even edge detection.
At the beginning, I found it challenging to implement both the image processing library and parse inputted arguments, but after I had built code around those, it was really easy to add new arguments and check image data.
If you want to run this, you can download a prebuilt binary from the demo link, or alternatively you can watch an asciinema demo from the same link. If running the binary, please make sure that libSkiaSharp.so / libSkiaSharp.dll stay in the same directory as the executable.

  • 9 devlogs
  • 11h
  • 11.93x multiplier
  • 133 Stardust
Try project → See source code →
Open comments for this post

43m 20s logged

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

0
0
1
Open comments for this post

1h 17m 9s logged

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

0
0
3
Open comments for this post

1h 14m 35s logged

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).

0
0
4
Open comments for this post

1h 31m 54s logged

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:

0
0
3
Open comments for this post

1h 57m 32s logged

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.

0
0
3
Open comments for this post

2h 29m logged

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.

0
0
3

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…