Draw images in your ANSI terminal with true color

Overview
   ___  _____  ____
  / _ \/  _/ |/_/ /____ ______ _      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.
Issues
  • 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.

    opened by diamondburned 10
  • 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
    enhancement 
    opened by brutestack 7
  • 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.

    opened by guitmz 7
  • 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.

    opened by lukasmalkmus 4
  • 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.

    opened by disq 3
  • 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?

    opened by mattLLVW 2
  • 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.

    opened by MichaelMure 2
  • 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

    opened by lmorg 2
  • 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.

    opened by drkmrin78 2
  • 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).

    opened by Calinou 1
  • 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]

    opened by gmelchett 1
Releases(v1.3.1)
  • v1.3.1(Dec 27, 2019)

    ⭐ PIXterm 1.3.1 ⭐ ‿︵‿( °ω° )‿︵‿

    • Improved source code structure.
    • Some corrections from contributors! 💖...
      • More conventional go.mod file at repository - @MichaelMure.
      • Use HTTPS URLs everywhere - @Calinou.
      • Other awesome contributions - @Calinou.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Dec 10, 2019)

    pixterm_credits

    ⭐ PIXterm 1.3.0 ⭐ ¯\_(ツ)_/¯ 😜🎉 ‿︵‿︵‿︵‿︵( °ω° )︵‿︵‿︵‿︵‿

    • Updated to use standard Go module system.
    • Code structure now uses Standard Go Project Layout.
    • Lastest versions of many packages.
    • Corrections and new functionalities from contributors! 💖...
      • Color support for Windows (Command Prompt & PowerShell) - @brutestack.
      • Original code for disable background color in dithering mode - @brutestack.
      • Original code for output Go code to fmt.Print() the image - @brutestack.
      • NewFromImage() & NewScaledFromImage() for ANSImage API - @diamondburned.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.4(Jul 3, 2018)

  • v1.2.3(Feb 27, 2018)

  • v1.2.1(Dec 16, 2017)

Owner
Eliuk Blau
Eliuk Blau
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

Weiran Huang 42 Jul 10, 2022
🎨 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 环境的色彩渲染

Gookit 1.1k Aug 1, 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

null 6 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

Anders Björklund 1 Jan 4, 2022
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

Mario Gutierrez 364 Jul 10, 2022
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

Will Dixon 57 May 31, 2022
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

Fatih Arslan 5.5k Aug 8, 2022
Color quantization experiment for golang

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

Sapphire Cat 0 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 _ ___ _ _ ___|_|___| _|___| |_ ___| |_ | . | |___| _| -_| _

wise 0 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. Installation Requirements: golang >= 1.13 Manual Clone the repo Run make && make install Pack

Eric Moynihan 513 Jul 19, 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

Clay Dowling 0 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

Felipe Volpone 4 Jun 2, 2022
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.

Cian Gallagher 33 Jul 23, 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

Abdul Fattah Ikhsan 27 Jul 29, 2022
🎄 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

Matthew Gleich 37 Jan 3, 2022
❓🖼 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

Ilya Revenko 706 Jul 31, 2022
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.

Reece Mercer 41 Apr 26, 2022
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

WTFUtil 13.6k Aug 1, 2022
GIFs in your terminal

gifwrap GIFs in your terminal. Install Download the latest binary or install with Go: go install github.com/liamg/gifwrap/cmd/[email protected] Usage Usa

Liam Galvin 37 Jul 2, 2022