terminalimage

package module
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2023 License: MIT Imports: 11 Imported by: 0

README

Terminal Image

With this package can you display an image in your terminal.

The height of the generated image is customizable.

The supported image-types are png (.png), jpeg (.jpg, .jpeg, .jfif), singleframe gif (.gif) and webP (.webp).

Usage

To import the package use go get github.com/fabiokaelin/terminalimage.

package main

import (
	"fmt"

	"github.com/fabiokaelin/terminalimage"
)

func main() {
	imageString, err := terminalimage.ImageToString("img.png", 20, true)
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(imageString)
}

Image Example

To show the convertion, here is the original image:

Icon of the superman soundtrack on spotify

The following are the converte ones:

64 pixel with pixelsplit on:

64 Pixel with pixelsplit on

64 pixel with pixelsplit off:

64 Pixel with pixelsplit off

20 pixel with pixelsplit on:

20 Pixel with pixelsplit on

20 pixel with pixelsplit off:

20 Pixel with pixelsplit off

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Example added in v1.1.0

func Example()

func ImageToString

func ImageToString(path string, height int, pixelSplit bool) (string, error)

func ImgDataToArray

func ImgDataToArray(imageData image.Image, height int, pixelSplit bool) ([]string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL