/imgcat

Go port of the iTerm2 imgcat script

Primary LanguageGoMIT LicenseMIT

About

GoDoc

Go port of the iTerm2 imgcat script

NOTE: requires iTerm2 2.9 or newer.

Install command line

go install github.com/martinlindhe/imgcat@latest

Use the lib in your terminal app

package main

import "github.com/martinlindhe/imgcat/lib"

func main() {
    inFile := "file.jpg"

    // using a io.Reader
	f, _ := os.Open(inFile)
	imgcat.Cat(f, os.Stdout)

    // using filename
    imgcat.CatFile(inFile, os.Stdout)

    // using a image.Image
    canvas := image.NewRGBA(image.Rect(0, 0, 20, 20))
    canvas.Set(10, 10, image.NewUniform(color.RGBA{255, 255, 255, 255}))
    imgcat.CatImage(canvas, os.Stdout)
}

License

Under MIT