Skip to content

Q-Smith/go-ansipix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

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.

ASCII/ANSI Art

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

Approach

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

Example Screens

Screen Captures
ANSI 256 Colors ANSI 256 Colors
Yie-Ar-Kung-Fu Yie-Ar-Kung-Fu

Yie-Ar-Kung-Fu

References

Releases

No releases published

Packages

No packages published

Languages