go-ansipix

module
v0.0.0-...-054a08a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2018 License: MIT

README

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

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL