Convert ANSI output to SVG

ansisvg

Convert ANSI output to SVG.

Pipe output from program thru ansisvg and it will output a SVG file on stdout.

./colortest | ansisvg > colortest.ansi.svg

Produces colortest.ansi.svg

ansisvg output for colortest

$ ansisvg -h
Usage of ansisvg:
  -charboxsize value
    	Character box size (default 8x16)
  -colorscheme string
    	Color scheme (default "Builtin Dark")
  -fontname string
    	Font name (default "Monaco, Lucida Console, Courier")
  -fontsize int
    	Font size (default 14)
  -transparent
    	Transparent background
  -width int
    	Terminal width (auto)

Color themes are the ones from https://github.com/mbadolato/iTerm2-Color-Schemes

Install

# build from cloned repo
go build -o ansisvg main.go

# install directly
go install github.com/wader/ansisvg@master
# copy binary to $PATH
cp $(go env GOPATH)/bin/ansisvg /usr/local/bin

Tricks to force color output from programs

script

script -q /dev/null | ansisvg

ffmpeg

TERM=a AV_LOG_FORCE_COLOR=1 ffmpeg ... 2>&1 | ansisvg

jq

jq -C | ansisvg

Licenses and thanks

Color themes from https://github.com/mbadolato/iTerm2-Color-Schemes, license https://github.com/mbadolato/iTerm2-Color-Schemes/blob/master/LICENSE

colortest from https://github.com/pablopunk/colortest

TODO and ideas

  • Bold
  • Handle vertical tab and form feed (normalize into spaces?)
  • Handle overdrawing
  • More CSI, keep track of cursor?
  • PNG output
Owner
Mattias Wadman
🦆
Mattias Wadman
Similar Resources

:foggy: Convert image to ASCII

:foggy: Convert image to ASCII

🌁 Image2ascii Image2ASCII is a library that converts images into ASCII images and provides command-line tools for easy use. Installation go get githu

Jan 8, 2023

Draw graphs through GO MOD GRAPH output

Draw graphs through GO MOD GRAPH output

go-mod-graph-chart build chart by go mod graph output Install $ go get -u github.com/PaulXu-cn/go-mod-graph-chart/gmchart Usage

Dec 14, 2022

A cross-platform tool to convert images into ascii art and print them on the console

A cross-platform tool to convert images into ascii art and print them on the console

A cross-platform tool to convert images into ascii art and print them on the console

Dec 30, 2022

Convert images to computer generated art using delaunay triangulation.

Convert images to computer generated art using delaunay triangulation.

▲ Triangle is a tool for generating triangulated image using delaunay triangulation. It takes a source image and converts it to an abstract image comp

Dec 29, 2022

package for convert DataURLs to image

convert base64 DataURLs to image

Oct 18, 2021

Small project to convert images to grayscale

This is a small http server that will read images from a provided path, convert the image to gray, and then serve back the converted image Usage You c

Nov 5, 2021

A command to output longified ascii art.

longify A command to output longified ascii art. Inspired by Tweet from @sheepla: https://twitter.com/Sheeeeepla/status/1522199846870196225 Installati

Sep 12, 2022

2D rendering for different output (raster, pdf, svg)

2D rendering for different output (raster, pdf, svg)

draw2d Package draw2d is a go 2D vector graphics library with support for multiple outputs such as images (draw2d), pdf documents (draw2dpdf), opengl

Dec 25, 2022

A tiny markup language for terminal output. Makes formatting output in CLI apps easier!

A tiny markup language for terminal output. Makes formatting output in CLI apps easier!

tml - Terminal Markup Language A Go module (and standalone binary) to make the output of coloured/formatted text in the terminal easier and more reada

Dec 14, 2022

A simple tool to extract Fronius solar data logger output and output Influx line protocol

telegraf-exec-fronius This is a simple tool to extract Fronius solar data logger output and output Influx line protocol; it is designed to be used wit

Jan 8, 2022

Read data from rss, convert in pdf and send to kindle. Amazon automatically convert them in azw3.

Kindle-RSS-PDF-AZW3 The Kindle RSS PDF AZW3 is a personal project. The Kindle RSS PDF AZW3 is a personal project. I received a Kindle for Christmas, a

Jan 10, 2022

Golang ultimate ANSI-colors that supports Printf/Sprintf methods

Golang ultimate ANSI-colors that supports Printf/Sprintf methods

Aurora Ultimate ANSI colors for Golang. The package supports Printf/Sprintf etc. TOC Installation Usage Simple Printf aurora.Sprintf Enable/Disable co

Dec 29, 2022

An ANSI colour terminal package for Go

colourize An ANSI colour terminal package for Go. Supports all ANSI colours and emphasis. Not compatible with Windows systems. Installation go get gi

Sep 26, 2022

Simple ANSi to PNG converter written in pure Go

AnsiGo Description AnsiGo is a simple ANSi to PNG converter written in pure Go. It converts files containing ANSi sequences (.ANS) into PNG images. Fo

May 17, 2022

A collection of (ANSI-sequence aware) text reflow operations & algorithms

A collection of (ANSI-sequence aware) text reflow operations & algorithms

reflow A collection of ANSI-aware methods and io.Writers helping you to transform blocks of text. This means you can still style your terminal output

Dec 29, 2022

Draw images in your ANSI terminal with true color

Draw images in your ANSI terminal with true color

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

Dec 14, 2022

Advanced ANSI style & color support for your terminal applications

Advanced ANSI style & color support for your terminal applications

termenv lets you safely use advanced styling options on the terminal. It gathers information about the terminal environment in terms of its ANSI & col

Dec 31, 2022

This project provides Go bindings for nuklear.h — a small ANSI C GUI library.

This project provides Go bindings for nuklear.h — a small ANSI C GUI library.

Nuklear Package nk provides Go bindings for nuklear.h — a small ANSI C gui library. See github.com/vurtun/nuklear. All the binding code has automatica

Jan 1, 2023

A library for parsing ANSI encoded strings

 A library for parsing ANSI encoded strings

Go ANSI Parser converts strings with ANSI escape codes into a slice of structs that represent styled text

Sep 20, 2022
Comments
  • recognizing more colors

    recognizing more colors

    If I use color codes like \e[0;32m in my shell scripts I see the color in the svg.

    But the colors from lolcat show up as grey in the svg ansisvg creates.

    I have no idea how lolcat gets those colors. Have you seen that program? It would be so amazing to be able to pipe lolcat to ansisvg - SO amazing.

  • build errors

    build errors

    Hello and happy first issue! It's a great sounding project, I hope you enjoy making it!

    I'm getting errors trying to build...

    ❯ go install github.com/wader/ansisvg@master
    can't load package: package github.com/wader/ansisvg@master: can only use path@version syntax with 'go get'
    
    git clone [email protected]:wader/ansisvg.git
    cd ansisvg
    ❯ go build -o ansisvg main.go
    build command-line-arguments: cannot load embed: malformed module path "embed": missing dot in first path element
    

    In case my go env details are helpful in this:

    GO111MODULE=""
    GOARCH="amd64"
    GOBIN=""
    GOCACHE="/home/alec/.cache/go-build"
    GOENV="/home/alec/.config/go/env"
    GOEXE=""
    GOFLAGS=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GONOPROXY=""
    GONOSUMDB=""
    GOOS="linux"
    GOPATH="/home/alec/go"
    GOPRIVATE=""
    GOPROXY="https://proxy.golang.org,direct"
    GOROOT="/usr/lib/go-1.13"
    GOSUMDB="sum.golang.org"
    GOTMPDIR=""
    GOTOOLDIR="/usr/lib/go-1.13/pkg/tool/linux_amd64"
    GCCGO="gccgo"
    AR="ar"
    CC="gcc"
    CXX="g++"
    CGO_ENABLED="1"
    GOMOD="/home/alec/code/software_projects/ansisvg/go.mod"
    CGO_CFLAGS="-g -O2"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    PKG_CONFIG="pkg-config"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build483368982=/tmp/go-build -gno-record-gcc-switches"
    
Simple ANSi to PNG converter written in pure Go

AnsiGo Description AnsiGo is a simple ANSi to PNG converter written in pure Go. It converts files containing ANSi sequences (.ANS) into PNG images. Fo

May 17, 2022
A collection of (ANSI-sequence aware) text reflow operations & algorithms
A collection of (ANSI-sequence aware) text reflow operations & algorithms

reflow A collection of ANSI-aware methods and io.Writers helping you to transform blocks of text. This means you can still style your terminal output

Dec 29, 2022
Rasterx is an SVG 2.0 path compliant rasterizer that can use either the golang vector or a derivative of the freetype anti-aliaser.
Rasterx is an SVG 2.0 path compliant rasterizer that can use either the golang vector or a derivative of the freetype anti-aliaser.

rasterx Rasterx is a golang rasterizer that implements path stroking functions capable of SVG 2.0 compliant 'arc' joins and explicit loop closing. Pat

Nov 1, 2022
Go Language Library for SVG generation
Go Language Library for SVG generation

SVGo: A Go library for SVG generation The library generates SVG as defined by the Scalable Vector Graphics 1.1 Specification (http://www.w3.org/TR/SVG

Jan 6, 2023
Cairo in Go: vector to SVG, PDF, EPS, raster, HTML Canvas, etc.
Cairo in Go: vector to SVG, PDF, EPS, raster, HTML Canvas, etc.

Canvas is a common vector drawing target that can output SVG, PDF, EPS, raster images (PNG, JPG, GIF, ...), HTML Canvas through WASM, and OpenGL. It h

Dec 25, 2022
gensvg generates SVG to an io.Writer
gensvg generates SVG to an io.Writer

gensvg: A Go library for SVG generation The library generates SVG as defined by the Scalable Vector Graphics 1.1 Specification

Dec 28, 2022
A simple API written in Go that creates badges in SVG format, based on the requested route.

A simple API written in Go that creates badges in SVG format, based on the requested route. Those graphics can be used to style README.md files, or to add tags to webpages.

Jul 2, 2021
Very simple SVG to PNG converter library using the Inkscape.

svg2png Description Very simple SVG to PNG converter library using the Inkscape.

Jan 11, 2022
Snippit - Creates syntax-highlighted code snippets in png or svg format
Snippit - Creates syntax-highlighted code snippets in png or svg format

snippit creates syntax-highlighted code snippets in png or svg format. Installat

Oct 10, 2022
Go-binsize-treemap - Go binary size SVG treemap

?? Go binary size SVG treemap Make treemap breakdown of Go executable binary $ g

Dec 21, 2022