~dricottone/image2ascii

ref: e652cc70f10789425f1c36a99d0a8c7ea3542454 image2ascii/README.md -rw-r--r-- 847 bytes
e652cc70 — qeesung UPDATE README 6 years ago

#image2ascii

Convert image to ASCII

#installation

go get https://github.com/qeesung/image2ascii

#usage

package main

import (
	"fmt"
	"github.com/qeesung/image2asicc/convert"
	"image"
	_ "image/jpeg"
	_ "image/png"
	"log"
	"os"
)

func main() {
	f, err := os.Open("example/images/lufei.jpg")
	if err != nil {
		log.Fatal(err)
	}

	img, _, err := image.Decode(f)
	if err != nil {
		log.Fatal(err)
	}

	f.Close()
	asciiImage := convert.Image2ASCIIString(img, &convert.Options{
		Ratio: 0.2,
	})
	fmt.Print(asciiImage)
}

output

Raw Image ASCII Image