Draw images in your ANSI terminal with true color

   ___  _____  ____
  / _ \/  _/ |/_/ /____ ______ _      Made with love by Eliuk Blau
 / ___// /_>  </ __/ -_) __/  ' \ https://github.com/eliukblau/pixterm
/_/  /___/_/|_|\__/\__/_/ /_/_/_/                1.3.1

PIXterm - draw images in your ANSI terminal with true color

PIXterm shows images directly in your terminal, recreating the pixels through a combination of ANSI character background color and the unicode lower half block element. If image has transparency, an optional matte color can be used for background. Also, you can specify a dithering mode; in which case, the image is rendered using block elements with different shades, or using standard ASCII characters in the same way. In dithering mode, the matte color is used to fill the background of the blocks or characters.

The conversion process runs fast because it is parallelized in all CPUs.

Supported image formats: JPEG, PNG, GIF, BMP, TIFF, WebP.

Fetching images from HTTP/HTTPS is supported too.

Cool Screenshots

Screenshot 1

No Dithering (Classic Mode)

Screenshot 2

Screenshot 3

Screenshot 4

Screenshot 5

Screenshot 6

Dithering with Blocks

Screenshot 7

Screenshot 8

Screenshot 9

Dithering with Characters

Screenshot 10

Screenshot 11

Screenshot 12

Dithering with Background Color Disabled (-nobg)

Screenshot 13

Screenshot 14

Requirements

Your terminal emulator must be support true color feature in order to display image colors in a right way. In addition, you must use a monospaced font that includes the lower half block unicode character: ▄ (U+2584). I personally recommend Envy Code R. It's the nice font that shows in the screenshots. If you want to use the dithering mode with blocks, the font must also includes the following unicode characters: █ (U+2588), ▓ (U+2593), ▒ (U+2592), ░ (U+2591). The dithering mode with characters works with standard ASCII chars.

Dependencies

All dependencies are included via standard Go module system. You should not do anything else.

Dependencies for PIXterm CLI tool
  • Package colorful: github.com/lucasb-eyer/go-colorful
  • Package terminal: golang.org/x/crypto/ssh/terminal
Dependencies for ANSImage Package
  • Package colorful: github.com/lucasb-eyer/go-colorful
  • Package imaging: github.com/disintegration/imaging
  • Package webp: golang.org/x/image/webp
  • Package bmp: golang.org/x/image/bmp
  • Package tiff: golang.org/x/image/tiff

Installation

You need the Go compiler version 1.13 or superior installed in your system.

Run this command to automatically download sources and install PIXterm binary in your $GOPATH/bin directory:

go get -u github.com/eliukblau/pixterm/cmd/pixterm

If you use Arch Linux, eigengrau has kindly created an AUR package for PIXterm (thanks man!). Run this command to install it:

yaourt -S pixterm-git

About

PIXterm is a terminal toy application that I made to exercise my skills on Go programming language. If you have not tried this language yet, please give it a try! It's easy, fast and very well organized. You'll not regret 😜

This application is originaly inspired by the clever termpix, implemented in Rust.

The dithering mode is my own port of the Processing Textmode Engine's render.

License

Mozilla Public License Version 2.0

Contributors

  • @disq

    • Original code for image transparency support.
  • @timob

    • Fix for ANSIpixel type: use 8bit color component for output.
  • @HongjiangHuang

    • Original code for image download support.
  • @brutestack

    • Color support for Windows (Command Prompt & PowerShell).
    • Original code for disable background color in dithering mode.
    • Original code for output Go code to fmt.Print() the image.
  • @diamondburned

    • NewFromImage() & NewScaledFromImage() for ANSImage API.
  • @MichaelMure

    • More conventional go.mod file at repository.
  • @Calinou

    • Use HTTPS URLs everywhere.
    • Other awesome contributions.
Comments
  • a NewFromImage function

    a NewFromImage function

    It seems like there is no exported NewFromImage method, which is really ironic, considering how the unexported function takes in one. I could do a PR if you want.

  • Windows colors support (cmd & PowerShell) + extra options

    Windows colors support (cmd & PowerShell) + extra options

    1. Adds Windows console colors support for Command Prompt and PowerShell
    2. Adds option to output format string instead of image. Output then can be used in Printf function to print image in users application.
    3. Adds option to disable setting backgrounds for cahracters
  • Create a library instead of only a cli application

    Create a library instead of only a cli application

    How does this idea sound to you? I came across your project and really wanted to use it in one of my hobby projects. In the current state, I had to copy and paste a bunch of your code but making it a library would be very much nicer.

  • Can't build due compile time error

    Can't build due compile time error

    I tried to vendor the ansimage package using dep. But when compiling my project I see two errors of kind multiple-value colorful.MakeColor() in single-value context in those lines:

    https://github.com/eliukblau/pixterm/blob/a39660c811b7075c5de15f35350f27d6d4dfe630/ansimage/ansimage.go#L466-L467

    The error makes perfect sense, but I don't get what went wrong here. You may have used a very old version of go-colorful. Check out the releases, I might make sense to update your glide config tot use the 1.0 release.

  • Composite images over black or white matte to fix alpha-channel related issues

    Composite images over black or white matte to fix alpha-channel related issues

    This PR makes up for the fact that ANSI color sequences don't support opacity/alpha channel.

    A new command-line option -m is added to specify the matte color. 0 (default) for black, 1 for white.

  • Draw animated gifs

    Draw animated gifs

    I'm using pixterm to convert animated gifs for my project: https://github.com/mattLLVW/e.xec.sh

    Would you be interested in a PR adding this functionality?

  • more conventional single go.mod at the repo root

    more conventional single go.mod at the repo root

    The vast majority of go module package have a single go.mod at the root. With the way it's done at the moment, go get a bit confused. You can't import only the ansimage package with the tag and you have to import with a commit hash (github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75).

    Note: having the pixterm command in the same go module in not really a problem. go.mod define a coherent set of file as a package, not a compilation unit. It's entirely valid to import the whole thing and only use (and compile) ansimage. If you really want to separate the two, you can either split the command into its own repo or add another go.mod for the command while keeping the root one.

    Also, the replace directive, while working, is really something that should be used only for advanced use cases like a local fork.

    I understand that you structured the project according to https://github.com/golang-standards/project-layout, but they also say that the layout will need to be changed for go modules.

    Also, it compiles without problem with go 1.12.

  • Fix compile time error

    Fix compile time error

    vendor/github.com/eliukblau/pixterm/ansimage/ansimage.go:501:36: multiple-value colorful.MakeColor() in single-value context vendor/github.com/eliukblau/pixterm/ansimage/ansimage.go:502:34: multiple-value colorful.MakeColor() in single-value context

  • Transparent bacground

    Transparent bacground

    Is there a way to make the background transparent? as in not black or white, but transparent with the terminal. I really want some images turned to ascii with colors but let the background be transparent like my terminal. Your tool does the best job with colors and gradients from what I've seen.

  • Use HTTPS URLs everywhere

    Use HTTPS URLs everywhere

    This avoids redirects when opening a website that enforces HTTPS usage.

    This also makes the link clickable in pixterm's help message (in terminal emulators that support automatic link creation).

  • Update ansimage compile with latest on dependencies

    Update ansimage compile with latest on dependencies

    Which includes:

    • Remove glide
    • Adopt to colorful API change
    • Add go module support for ansimage
    • Move pixman to cmd directory
    • Update documentation
    • Remove vendor directory

    Signed-off-by: Jonas Aaberg [email protected]

  • Update README.md

    Update README.md

    Unix/Go package is required be updated to the latest if you are on go version 1.19 added the command to readme for apple devices because it is not done by default (with go get or go mod tidy) and only some go project repos will trigger this requirement

  • apple  (arm64) m1 device cannot compile

    apple (arm64) m1 device cannot compile

    terminal input

    go mod tidy
    go run cmd/pixterm/pixterm.go
    

    error output:

    # command-line-arguments
    cmd/pixterm/pixterm.go:64:3: undefined: printIcon
    cmd/pixterm/pixterm.go:68:2: undefined: printContributors
    

    For some odd reason there's an issue within func printCredits()

    printIcon() & printContributers() are out of scope therefore unreachable

    if you comment out printIcon() & printContributers() within func printCredits() then it builds successfully

Generate ANSI-/Ascii-art version images/Gifs in your terminal.
Generate ANSI-/Ascii-art version images/Gifs in your terminal.

ANSI-Art NOTE: This toy project is not yet finished. ANSI-version Logo Block ANSI-version Logo ASCII-version Logo Support Platform You are kindly remi

Jan 6, 2023
🎨 Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows.
🎨 Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows.

?? Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows. GO CLI 控制台颜色渲染工具库,支持16色,256色,RGB色彩渲染输出,使用类似于 Print/Sprintf,兼容并支持 Windows 环境的色彩渲染

Dec 30, 2022
A Go package for converting RGB and other color formats/colorspaces into DMC thread colors (DMC color name and floss number)

go-c2dmc A Go package for converting RGB and other color formats/colorspaces into DMC thread colors (DMC color name and floss number). Implemented as

Jul 25, 2022
A Go library for terminal background color detection

go-termbg A Go library for terminal background color detection. The detected color is provided by RGB or theme ( dark or light ). Based on https://git

Jan 4, 2022
Images for your terminal.
Images for your terminal.

imeji イメジ ー Images for the terminal imeji is a lightweight alternative to the awesome chafa. It is written in go and can be easily embedded into tools

May 9, 2023
Small, fast library to create ANSI colored strings and codes. [go, golang]

ansi Package ansi is a small, fast library to create ANSI colored strings and codes. Install Get it go get -u github.com/mgutz/ansi Example import "gi

Dec 23, 2022
A simple logging interface that supports cross-platform color and concurrency.
A simple logging interface that supports cross-platform color and concurrency.

WLog Package wlog creates simple to use UI structure. The UI is used to simply print to the screen. There a wrappers that will wrap each other to crea

Sep 26, 2022
Color package for Go (golang)
Color package for Go (golang)

color Color lets you use colorized outputs in terms of ANSI Escape Codes in Go (Golang). It has support for Windows too! The API can be used in severa

Dec 31, 2022
Color quantization experiment for golang

bitcrush Color quantization experiment, version 4 Build git clone https://github

Jun 15, 2022
Pi-fetch - get a summary of your pi-hole stats from your terminal

pi-fetch get a summary of your pi-hole stats from your terminal _ ___ _ _ ___|_|___| _|___| |_ ___| |_ | . | |___| _| -_| _

Jan 9, 2022
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal.
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal.

Stonks is a terminal based stock visualizer and tracker. Installation Requirements: golang >= 1.13 Manual Clone the repo Run make && make install Pack

Dec 16, 2022
Command line tool to copy images from a camera SD card to your hard drive

Command line tool to copy images from a camera SD card to your hard drive

Nov 26, 2021
Are you programming and suddenly your stomach is rumbling? No problem, order your Ifood without leaving your favorite text editor ❤️

vim-ifood Você ta programando e de repente bateu aquela fome? Sem problemas, peça seu Ifood sem sair do seu editor de texto favorito ❤️ Are you progra

Jun 2, 2022
gomerge is a tool to quickly bulk merge several pull requests from your terminal.
gomerge is a tool to quickly bulk merge several pull requests from your terminal.

Gomerge is a tool to quickly enable you to bulk merge Github pull requests from your terminal. The intention of this tool is to simplfy, and eventually automate the merging of github pull requests. This tool should be able to run on most systems.

Dec 28, 2022
YouTube client on your terminal

MeowTube YouTube client on your terminal Table of Contents About Getting Started Usage Contributing About MeowTube is a CLI (Command Line Interface) t

Jul 29, 2022
🎄 A Christmas tree right from your terminal!
🎄 A Christmas tree right from your terminal!

ctree ?? A Christmas tree right from your terminal! ?? Demo ⌛ No Refresh Don't want the tree to refresh every 2 seconds? Easy! Just add the --no-refre

Dec 20, 2022
❓🖼 Find the anime scene by image using your terminal
❓🖼 Find the anime scene by image using your terminal

What Anime CLI ❓ ?? > This application is basically a ?? wrapper around trace.moe PREVIEW Usage ?? Get Anime By Image File ?? what-anime file anime.jp

Jan 2, 2023
Pi-hole data right from your terminal. Live updating view, query history extraction and more!
Pi-hole data right from your terminal. Live updating view, query history extraction and more!

Pi-CLI Pi-CLI is a command line program used to view data from a Pi-Hole instance directly in your terminal.

Dec 12, 2022
The personal information dashboard for your terminal
The personal information dashboard for your terminal

WTF (aka 'wtfutil') is the personal information dashboard for your terminal, providing at-a-glance access to your very important but infrequently-need

Dec 31, 2022