Skip to content

This is a small command-line tool to convert an image to ASCII art. It takes an image file as input and generates ASCII art on the console.

Notifications You must be signed in to change notification settings

real0x0a1/ImageToASCII

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

ASCII Image Converter

This is a small command-line tool to convert an image to ASCII art. It takes an image file as input and generates ASCII art on the console.

Usage

go run main.go [image_file_path]

Replace [image_file_path] with the path to the image file you want to convert.

Requirements

  • Go 1.15 or higher

How it works

  1. The tool loads the specified image file using the loadImage function. It supports PNG and JPEG image formats.
  2. It iterates over each pixel in the image and converts it to grayscale.
  3. The grayscale value is used to determine the density value, which represents the ASCII character to be used.
  4. The tool prints the ASCII character corresponding to the density value to the console.
  5. The process is repeated for each pixel in the image until the entire image is converted to ASCII art.

ASCII Density Chart

The following density chart is used to convert grayscale values to ASCII characters:

  • " " - Lowest density (grayscale value 0)
  • "." - Low density
  • "=" - Medium density
  • "!" - High density
  • "░" - Higher density
  • "▒" - Even higher density
  • "▓" - Very high density
  • "█" - Highest density (grayscale value 255)

Example

go run main.go example.png

Output:

...

Author

  • Ali (Real0x0a1)

About

This is a small command-line tool to convert an image to ASCII art. It takes an image file as input and generates ASCII art on the console.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages