Skip to content

Instantly share code, notes, and snippets.

@saitoha
Last active January 16, 2023 13:16
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save saitoha/8539548 to your computer and use it in GitHub Desktop.
Save saitoha/8539548 to your computer and use it in GitHub Desktop.
SIXEL color graphics DEMO (xterm pl#301 and gnuplot)
#
# SIXEL color graphics DEMO
#
# xterm pl#301 with --enable-sixel-graphics option
# gnuplot with --with-bitmap-terminals option
#
# Now the color palette of xterm VT-340 mode is limited to 16.
# If you want to change it to 256, apply the following patch.
# https://gist.github.com/saitoha/7822989/raw/20727b88f0f826bfcb9d644907944b29a456b67f/graphics.c.diff
#
# If you are using stable version of gnuplot,
# you can also use sixel format without using sixel driver
# by installing netpbm and doing the following operations.
#
# gnuplot> set terminal pngcairo
# gnuplot> set output '| pngtopnm | pnmquant 16 | ppmtosixel'
# gnuplot> splot x * x
#
# other resources
# ===============
#
# - anothor sixel patch for gnuplot, written by @kmiya
# (It seems to support pm3d feature, looks better)
# http://nanno.dip.jp/softlib/man/rlogin/gnuplot-sixel.tar.gz
#
# - netpbm (sixel is supported as only output format)
# http://netpbm.sourceforge.net/
#
# - sixel converter (which has sixel encoder/decoder),
# written by @kmiya (requires GD)
# http://nanno.dip.jp/softlib/man/rlogin/sixel.tar.gz
#
# - Chris F. Chiesa(1990), All about SIXELs
# ftp://ftp.cs.utk.edu/pub/shuford/terminal/all_about_sixels.txt
#
# - VT330/VT340 Programmer Reference Manual Volume 2: Graphics Programming
# http://vt100.net/docs/vt3xx-gp/chapter14.html
#
# - Genicom GEK 00031B Programmer's Manual [Page 256]: Sixel Graphics
# http://www.manualslib.com/manual/60628/Genicom-Gek-00031b.html?page=256#manual
#
# - GENICOM Matrix Printer LA36 User Manual
# http://www.theprinterplace.com/printers/manuals/GEB-00010A.pdf
#
# - some SIXEL data from comp.os.vms
# https://groups.google.com/forum/#!msg/comp.os.vms/7ns4E74ahK8/59y5NuOuGM4J
#
# - some SIXEL test data from Kermit Project
# ftp://kermit.columbia.edu/pub/kermit/sixel/
#
# - Two SIXEL files from VT100.net
# http://vt100.net/animation/xmas.zip
#
# - The Kermit Project (some version supports SIXEL)
# http://www.columbia.edu/kermit/
#
# - MS-DOS Kermit Graphics Screen Shots
# http://ftp.nluug.nl/networking/kermit/public_html/mskgraphics.html
#
# - Kermit on DOS Box DEMO by @arakiken
# http://mlterm.sourceforge.net/kermit-cb.png
#
# - VT382 monochrome SIXEL DEMO by @ttdoda
# http://twitpic.com/auaiv4
# http://twitpic.com/aub3g8
# http://twitpic.com/aucwv4
#
# - RLogin (Japanese terminal emulator, supports Tek, ReGIS and SIXEL)
# http://nanno.dip.jp/softlib/man/rlogin/
#
# - mlterm (Multi Lingual TERMinal emulator)
# http://sourceforge.net/projects/mlterm/
#
# - tanasinn
# http://zuse.jp/tanasinn/
#
XTERM=xterm-301
GNUPLOT=gnuplot
CURL=curl
RM=rm -f
TAR=tar
all: $(XTERM)/xterm $(GNUPLOT)/src/gnuplot
$(XTERM)/xterm \
-geometry 115x50 \
-ti vt340 \
+u8 \
-e '$(MAKE) -C$(PWD) demo'
clean:
$(RM) -r $(XTERM) $(GNUPLOT)
demo:
printf "\033]10;black\007" # set foreground color to black
printf "\033]11;white\007" # set background color to white
printf "\033[?80h" # enable sixel scrolling mode
cd $(GNUPLOT)/demo && ../src/$(GNUPLOT) -e "set term sixel" all.dem
$(GNUPLOT)/src/gnuplot: $(GNUPLOT)/Makefile
cd $(GNUPLOT) && make
$(GNUPLOT)/Makefile: $(GNUPLOT)/configure
cd $(GNUPLOT) && \
./configure \
--with-bitmap-terminals \
--without-lisp-files \
--without-tutorial
$(GNUPLOT)/configure: $(GNUPLOT)/prepare
cd $(GNUPLOT) && ./prepare
$(GNUPLOT)/prepare:
$(CURL) 'http://gnuplot.cvs.sourceforge.net/viewvc/gnuplot/gnuplot/?view=tar' | $(TAR) xz
$(XTERM)/xterm: $(XTERM)/Makefile
cd $(XTERM) && make
$(XTERM)/Makefile: $(XTERM)/configure
cd $(XTERM) && \
./configure \
--enable-wide-chars \
--enable-sixel-graphics \
--enable-256-color
$(XTERM)/configure:
$(CURL) ftp://invisible-island.net/xterm/$(XTERM).tgz | $(TAR) xz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment