x1unix / imgcat

Go port of the iTerm2 imgcat script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About

GoDoc

Go port of the iTerm2 imgcat script

NOTE: requires iTerm2 2.9 or newer.

Install command line

go get -u github.com/martinlindhe/imgcat

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

About

Go port of the iTerm2 imgcat script

License:MIT License


Languages

Language:Go 100.0%