Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

crgimenes/pngtoansi

Repository files navigation

pngtoansi

Convert PNG image to ANSI art using UTF-8 characters.

For best results it is necessary to use a font compatible with characters "█", "▀", "▄", I recommend the source code pro fount or even better use the 3270font.

Install

Install as a Utility

go install crg.eti.br/go/pngtoansi/cmd/pngtoansi 

Install as a Golang package

go get crg.eti.br/go/pngtoansi

Examples

Convert PNG to ANSI in the terminal

pngtoansi -f ./examples/gopher.png

Adjusted the background color. It is possible to change the color used to replace the transparent background using the -rgb parameter.

pngtoansi -f ./examples/test-01.png -rgb FFFFFF

Golang example

...
p := pngtoansi.New()
err = p.PrintFile("./examples/gopher.png", "FFFFFF")
if err != nil {
	fmt.Println(err)
	return
}

Contributing

  • Fork the repo on GitHub
  • Clone the project to your own machine
  • Create a branch with your modifications git checkout -b fantastic-feature.
  • Then commit your changes git commit -m 'Implementation of new fantastic feature'
  • Make a push to your branch git push origin fantastic-feature.
  • Submit a Pull Request so that we can review your changes