gotermimg

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: BSD-3-Clause, ISC, MIT Imports: 4 Imported by: 0

README

gotermimg

.github/workflows/main.yml

Update of github.com/moshen/gotermimg

Installation

Install using go install:

go install github.com/panekj/gotermimg/cmd/gotermimg@latest

Installs the gotermimg command line application.

Usage

Usage: gotermimg [-u] [-x=n] [-y=n] [IMAGEFILE]
IMAGEFILE - png or jpg.
Image data can be piped to stdin instead of providing IMAGEFILE.

If neither -x or -y are provided, and the image is larger than your current
terminal, it will be automatically scaled to fit.

-u=false: Enable UTF8 output
-x=0: Scale to n*2 columns wide in ANSI mode, n columns wide in UTF8 mode.
      When -x=0 (the default), aspect ratio is maintained.
      For example if -y is provided without -x, width is scaled to
      maintain aspect ratio
-y=0: Scale to n rows high in ANSI mode, n/2 rows high in UTF8 mode.
      When -y=0 (the default), aspect ratio is maintained.
      For example if -x is provided without -y, height is scaled to
      maintain aspect ratio

gotermimg on a png with transparency

gotermimg on an animated gif with transparency

While the render speed on some slower terminals might not look very good, urxvt looks amazing (click through for HQ).

gotermimg on urxvt

Author

Colin Kennedy

Libraries used

Documentation

Overview

Package gotermimg provides functions to convert image.Image structs to 256 color terminal compatible []string. It also provides functions to convert and "play" gif animations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ANSI

func ANSI(img image.Image, trans Transformer) []string

ANSI - Converts image.Image img to a []string of 256 color terminal compatbile ANSI using 2 spaces as a "pixel". Applies Transformer trans to img before conversion

func PrintImage

func PrintImage(img image.Image, conv Converter, trans Transformer)

PrintImage - Prints image.Image img to os.Stdout using Converter with Transformer trans

func UTF8

func UTF8(img image.Image, trans Transformer) []string

UTF8 - Converts image.Image img to a []string of 256 color terminal compatbile UTF8 using UTF8 1/2 blocks as a "pixel". Applies Transformer trans to img before conversion

Types

type Converter

type Converter func(image.Image, Transformer) []string

type Transformer

type Transformer func(image.Image) image.Image

func Resize

func Resize(width, height uint) Transformer

Directories

Path Synopsis
cmd
Package terminal provides the functions and constants required for 256 color terminal output and the conversion of color.Color structs to ColorCode
Package terminal provides the functions and constants required for 256 color terminal output and the conversion of color.Color structs to ColorCode

Jump to

Keyboard shortcuts

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