|
||
---|---|---|
screenshots | ||
LICENSE | ||
README.md | ||
bifur-bitmap.awk | ||
detect-font-geometry.py | ||
horigraph.awk | ||
mandelbrot-bitmap.awk | ||
population-bitmap.awk | ||
population.awk | ||
sixel.py | ||
sixkcd.bash | ||
text-test.sixel |
README.md
Sixel Experiments
A collection of experiments with sixel graphics.
What is this?
This is a collection of experiments with sixel graphics I decided to share with the world. Some things may be useful, but YMMV.
But Coffee, what on earth are sixel graphics?
👉 Did you know:
You can display actual bitmap images on the actual console in selected terminal emulators.
Observe:
How can I display sixel graphics?
First you need a sixel-capable terminal emulator
XTerm supports this, but needs a little nudging to enable:
$ xterm -xrm "XTerm*decTerminalID: vt340" -xrm "XTerm*numColorRegisters: 256"
But do you a favor and run the following:
$ echo "XTerm*decTerminalID: vt340" >> $HOME/.Xresources
$ echo "XTerm*numColorRegisters: 256" >> $HOME/.Xresources
$ echo "XTerm*disallowedWindowOps: 1,2,3,4,5,6,7,8,9,11,13,19,20,21,GetSelection,SetSelection,SetWinLines,SetXprop" >> $HOME/.Xresources
$ xrdb $HOME/.Xresources
And all your XTerm sessions will have 256-color sixel graphics enabled by default.
(The third line sets up some exceptions so we're allowed to query XTerm about its active screen size in pixels, from which we can then calculate the character cell size, which is kind of important to know when you want to align sixel graphics with text. Other terminal emulators already allow this by default.)
The only other sixel-capable X terminal emulator offered by Debian Buster is mlterm. No special options are needed to enable sixel graphics.
See the libsixel home page for other sixel-capable terminal emulators, including ones for the framebuffer console.
Then you need some sixel graphics
- Install
libsixel-bin
and use itsimg2sixel
program to display most common image formats. - ImageMagick (but not GraphicsMagick!) can convert to and from sixel format.
- All files in this repository ending in
.sixel
can simply be shown on the terminal withcat
. - Working programs in this repository will emit sixel graphics, if you can figure them out.
Status
This repository is intended for experiments, and not to hold mature programs. Programs may be in various stages of completion, and various stages of documentation, including not at all.
Screenshots
population.awk
:
horigraph.awk
:
population-bitmap.awk
(v1):
population-bitmap.awk
(v2):
bifur-bitmap.awk
:
text-test.sixel
:
mandelbrot-bitmap.awk
showing the full mandelbrot set:
mandelbrot-bitmap.awk
- usage - zooming in:
mandelbrot-bitmap.awk showing a zoomed-in view of the mandelbrot set:
sixkcd.bash black-on-white:
sixkcd.bash white-on-black:
Resources
- Sixel at Wikipedia
- Libsixel (github): Explanations, related projects, screenshots, examples. Its helper programs such as
img2sixel
are available from Debian Buster packagelibsixel-bin
. It also provides Python bindings, but sadly these aren't packaged for Buster. - All About SIXELs by Chris F. Chiesa.
- VT330/340 Programmer Reference Manual Volume 2 Chapter 14: Sixel Graphics
- "Jexer, a text windowing system that resembles Turbo Vision. The first and only text windowing system that supports mixed text and images to Xterm via sixel. Runs on Linux, Mac, and Windows. Written in Java. Feature complete."
Supplemental resources:
- XTerm Control Sequences
- ANSI escape code at Wikipedia
- POSIX.1-2017 Chapter 11: General Terminal Interface
Author
Contact
- Website: https://open.source.coffee
- Mastodon: @Coffee@toot.cafe
License
Copyright (C) 2022 by Coffee (@coffee@toot.cafe)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
The full text of this license can be found in the file called LICENSE.
SPDX-License-Identifier: AGPL-3.0-or-later [-> link]