This project takes images in the format PNG, GIF, BMP, JPEG and displays them within your terminal as colored character art. The goal is to have the characters displayed in color not just in black & white.
When looking into ASCII art there is a lot of information that overwhelms you and its hard to find a starting point. For example here is just a few phrases mentioned around the Internet:
- Fixed-width Fonts
- Grayscale
- Block Elements
- Character Ramps
- Extended ASCII
- ANSI Escape Codes
- Image Scaling
- Luminosity & Brightness
- Pixel Density / Dithering
To simplify the steps in rendering an image as characters here are the steps I took:
- Determine terminal dimensions
- Load the image
- Scale the image to fit terminal
- Calculate brightness from Pixel Density
- Map brightness to ASCII character
- Draw characters as series of ANSI escape codes
- Refactor code into a Go Package
Screen | Captures |
---|---|
- https://en.wikipedia.org/wiki/ASCII_art
- https://en.wikipedia.org/wiki/Block_Elements
- https://en.wikipedia.org/wiki/ANSI_escape_code
- https://en.wikipedia.org/wiki/Grayscale
- https://en.wikipedia.org/wiki/Dither
- https://en.wikipedia.org/wiki/Lanczos_resampling
- https://en.wikipedia.org/wiki/Vector_quantization
- https://en.wikipedia.org/wiki/Quantization_(signal_processing)
- https://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/
- http://www.roysac.com/tutorial/asciiarttutorial.html
- http://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html
- https://robertheaton.com/2018/06/12/programming-projects-for-advanced-beginners-ascii-art/
- https://www.fightersgeneration.com/games/yie-ar-kung-fu.html