A cross-platform command-line tool to convert images into ascii art and print them on the console. Now supports braille art!
Go to file
Zoraiz Hassan 4ba1c8c456
Updated README.md
2021-05-26 12:41:42 +05:00
cmd Version update 2021-05-26 11:36:53 +05:00
example_images Added example images 2021-05-12 02:41:26 +05:00
image_manipulation Refactor code, added colors flag, negative flag, image formats flag 2021-05-24 16:17:21 +05:00
.gitignore Version update 2021-05-26 11:36:53 +05:00
.goreleaser.yml Version update 2021-05-26 11:36:53 +05:00
LICENSE Licence update 2021-05-15 14:10:19 +05:00
README.md Updated README.md 2021-05-26 12:41:42 +05:00
go.mod Version update 2021-05-26 11:36:53 +05:00
go.sum Version update 2021-05-26 11:36:53 +05:00
main.go Added version flag 2021-05-24 17:28:53 +05:00
snapcraft.yaml Updated snapcraft.yaml to build locally 2021-05-26 12:00:29 +05:00

README.md

ascii-image-converter

ascii-image-converter is a command-line tool that converts images into ascii art and prints them out onto the console. It is cross-platform so both Windows and Linux distributions are supported

Image formats currently supported:

  • JPEG/JPG
  • PNG
  • WEBP
  • BMP
  • TIFF/TIF

Table of Contents

Example (Source):

Example

ASCII Art:

Example

Installation

Snap

You can download through snap. However, the snap will not have access to hidden images and images outside the $HOME directory.

sudo snap install ascii-image-converter --stable

Visit the app's snap store listing for instructions regarding enabling snapd on your distribution.


Go

For installing through Go

go install github.com/TheZoraiz/ascii-image-converter@latest

For physically installing the binaries, follow the steps with respect to your OS.

Linux

Extract the archive for your chosen Linux architecture after downloading it from here, and open the extracted directory.

Now, open a terminal in the same directory and execute this command:

sudo cp ascii-image-converter /usr/local/bin/

Now you can use ascii-image-converter in the terminal. Execute "ascii-image-converter -h" for more details.

Windows

You will need to set an Environment Variable to the folder the ascii-image-converter.exe executable is placed in to be able to use it in the command prompt. Follow the instructions in case of confusion:

Extract the archive for the your chosen Windows architecture after downloading it from here. Open the newly created folder and copy the path to it from the top of the file explorer.

  • In Search, search for and then select: System (Control Panel)
  • Click the Advanced System settings link.
  • Click Environment Variables. In the section User Variables find the Path environment variable and select it. Click "Edit".
  • In the Edit Environment Variable window, click "New" and then paste the path of the folder that you copied initially.
  • Click "Ok" on all open windows.

Now, restart any open command prompt and execute "ascii-image-converter -h" for more details.


Usage

Note: Decrease font size or increase terminal width (like zooming out) for maximum quality ascii art

To convert an image into ascii format, the usage is as follows:

ascii-image-converter [path to image]

Example

ascii-image-converter myImage.jpeg

Flags

--complex OR -c

Print the image with a wider array of ascii characters. Sometimes improves accuracy.

ascii-image-converter [path to image] -c
# Or
ascii-image-converter [path to image] --complex

--dimensions OR -d

Set the width and height for ascii art in CHARACTER lengths. (Don't immediately append another flag with -d)

ascii-image-converter [path to image] -d <width>,<height>
# Or
ascii-image-converter [path to image] --dimensions <width>,<height>

Example:

ascii-image-converter [path to image] -d 100,30

--color OR -C

Display ascii art with the colors from original image. Works with the -n flag as well.

ascii-image-converter [path to image] -C
# Or
ascii-image-converter [path to image] --color

--negative OR -n

Display ascii art in negative colors. Works with both uncolored and colored text from -C flag.

ascii-image-converter [path to image] -n
# Or
ascii-image-converter [path to image] --negative

--save OR -s

Save the printed ascii art in a file ascii-image.txt in the directory passed alongside. (Don't immediately append another flag with -s)

Example for current directory:

ascii-image-converter [path to image] --save ./
# Or
ascii-image-converter [path to image] -s ./

--formats OR -f

Display supported image formats.

ascii-image-converter [path to image] --formats
# Or
ascii-image-converter [path to image] -f

You can combine flags as well. Following command outputs colored and negative ascii art, with complex characters, fixed 100 by 30 character dimensions and saves the output in current directory as well.

ascii-image-converter [path to image] -Ccnd 100,30 -s ./

Contributing

You can fork the project and implement any changes you want for a pull request. However, for major changes, please open an issue first to discuss what you would like to implement.

Packages used

github.com/spf13/viper

github.com/spf13/cobra

github.com/mitchellh/go-homedir

github.com/nathan-fiscaletti/consolesize-go

github.com/nfnt/resize

github.com/gookit/color

License

Apache-2.0