Skip to content

nearlynithin/go-ascii

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASCII art

Converting images into ascii art!

Built with GO

GO

ASCII art means printing an image using ASCII characters with a monospace font. This project explains the methods used to convert an image into ASCII art mainly using Relative luminance method.


screenshot Example from assets/moe.png


Build

  1. Clone the repository
git clone https://github.com/nearlynithin/go-ascii.git
  1. cd into go-ascii
cd go-ascii/
  1. install dependencies
go mod download
  1. build command
go build -o go-ascii
  1. Add an image filename after the executable file
./go-ascii <image.png>
  1. You can list all the images in the assets directory
ls assets/

Flags

  • -color to print with color
./go-ascii -color <image.png>

File Structure

.
├── assets      //All your images go here
│   ├── eyes.jpg
│   ├── golang.png
│   ├── moe.png
│   ├── monogatari.jpeg
│   └── senjougahara.png
├── go.mod
├── go.sum
├── image_loader.go
├── main.go
├── printer.go
├── README.md
└── transformer.go

Usage

  • Make sure the terminal is zoomed out to get a better output
  • Supported file formats are jpg,jpeg,png.
  • To get rid of the blank space on the right side of the terminal, remove the lines 24 to 35 from transformer.go
  • Smaller the terminal, Better the image :)

Feel free to improve things and make a pull request, Thanks in Advance!

Tip

Pending stuff :P

  • Better algorithm to calculate aspect ratio according to the terminal width
  • Instructions for building on windows

Note

This was built on Ubuntu 24.04 LTS