Converting images into ascii art!
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.
- Clone the repository
git clone https://github.com/nearlynithin/go-ascii.git
- cd into
go-ascii
cd go-ascii/
- install dependencies
go mod download
- build command
go build -o go-ascii
- Add an image filename after the executable file
./go-ascii <image.png>
- You can list all the images in the
assets
directory
ls assets/
-color
to print with color
./go-ascii -color <image.png>
.
├── 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
- 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
to35
fromtransformer.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