Skip to content

mishpajz-FIT/BI-OOP-asciiart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASCII Art

pipeline status Code Coverage

The idea of this project is to load images, translate them into ASCII ART images, optionally apply filters, and save them.

This project is highly focused on adhering to OOP principles (and good software development practices in general), prioritizing extendability and maintainability. It is written in Scala and uses sbt as a build tool.

This project was started was created as a part of my 'Object-oriented programming' course at FIT CTU.

Usage

Run the application using sbt "run <args>". Run tests using sbt test.

The order of arguments does not matter, with the exception of filters. Initially, the image is imported, followed by the sequential application of filters as specified, and finally, it is exported.

Importing images

  • --image <path> to import a image from a file. Currently, PNG and JPEG file formats are supported.
  • --image-random to create a random image (random lines in different directions), the size of the image will be between [100; 300] in both width and height.

ASCII conversion table

A conversion table is used for converting between pixel value and ASCII character.

  • --table <name> to specify which predefined table to use. Current options are bourke and grayramp.
  • --custom-table <table> to define custom table using a string of characters, with first characters corresponding to darkest pixels and last characters to lightest pixels. (e.g. --custom-table "@#xw:. " will map characters in "@#xw:. " to pixels values.)

If no table is specified, the default table is used (bourke).

Exporting images

Images are currently exported in text form.

  • --output-file <path> to export the image into a text file.
  • --output-console to print the image into standard output.

Image can be exported multiple times.

Filters

  • --brightness <value> to change the brightness of all pixels in a imported image by a given value. Value must be integer and can be positive or negative.
  • --invert to invert the color of image (black becomes white...).
  • --flip <axis> to flip the image along a given axis. The axis can be either x or y.
  • --scale <scale> to scale the image by a given scale. This will change the amout of pixels in a image. The scale can be 0.25, 1 (identity) and 4. (e.g. --scale 0.25 will scale the image to 1/4 of its original size, meaning both dimensions of the image will be halved.)

The filters will be applied in the order they are passed to the application. Multiple filters of the same type can be applied.

Example

Before:
snowflake
After:
asciisnowflake

Snowflake PNGs by Vecteezy