Skip to content

simonMat21/petal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

petal

petal is a Go program that lets you display images directly in the terminal from either local images or web URLs.

It supports:

  • png (also works with transparent png)
  • jpg / jpeg
  • gif

The image source can be local or remote, so you can point it at a file on disk or an image from the internet.

How it works

We devide each line into 2 rows of pixels using "▄" charector. For the top pixel we color with by modifying the background charector and for the second pixel, we change the forground color.

Examples

The examples folder includes sample output for the main supported cases:

Example 1 - running a GIF from a local image

Example 1

Example 2 - running a GIF from the web

Example 2

Example 3 - running an image from a local file

Example 3

Example 4 - running an image from the web

Example 4

How To Run

Run the program with a local path or a web URL:

go run . <image-path-or-url>

Example:

go run . https://forum.playhive.com/uploads/default/original/3X/9/f/9fbb4321b65bdf33a08df00b50a6e34c3d1e98df.gif

You can also build the binary first:

go build -o petal.exe
./petal.exe <image-path-or-url>

If you want to control the terminal size used for rendering, pass columns and rows:

go run . <image-path-or-url> <cols> <rows>

Example:

go run . examples/example3.png 80 24

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages