Skip to content

A python script to transform images into ASCII art in your terminal. Nick Cage DLC included.

License

Notifications You must be signed in to change notification settings

hwixley/ASCII-Art-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASCII Art Generator

A customisable script to transform images into ASCII art.


CODEQL Python Version


Input image Output ASCII
cage

Installation

  1. Clone the repository:
    git clone git@github.com:hwixley/ascii-art-generator.git
    
  2. Install the dependencies:
    pip3 install -r requirements.txt
    

Run the script

You can run the script using shell:

chmod +x ascii-art-generator.sh && ./ascii-art-generator.sh

Or using python:

python3 src/ascii_art.py

Arguments

All the following arguments are optional.

  • Image: the path of your input image, defaults to Nick Cage.
    -i <img_path>   or   --img <img_path>

  • Image Width: the "ASCII pixel" (two horizontally adjacent ASCII characters) width of your output ASCII image, defaults to 80.
    -w <img-width>   or   --img-width <img-width>

  • Charset: the size of charset for your ASCII image (options: tiny, small, medium, large), defaults to small.
    -c <charset>   or   --charset <charset>

  • Sampler: the pixel density sampler type (options: linear, log, exp), defaults to linear.
    -s <sampler>   or   --sampler <sampler>

  • Lower Bound: the lower bound of pixel density sampling, defaults to 0.2. Bounded in the range [0,1].
    -l <lower-ptg>   or   --lower-ptg <lower-ptg>

  • Upper Bound: the upper bound of pixel density sampling, defaults to 0.4. Bounded in the range [0,1].
    -u <upper-ptg>   or   --upper-ptg <upper-ptg>

  • Save/generate image: if specified will put the ASCII art into a PNG.
    -g   or   --gen-img

Utility Args

  • Help: lists available arguments.
    -h   or   --help

  • Version: lists current version.
    -v   or   --version