~dricottone/image2ascii

ref: 427a0f9e7be0aee61a32645b2182361d291bd422 image2ascii/README.md -rw-r--r-- 855 bytes
427a0f9e — 秦世成 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/image2ascii/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)
}

#example outputs

Raw Image ASCII Image