Skip to content
forked from saitoha/libsixel

A C language SIXEL encoder/decoder implementation, forked from saitoha/libsixel after @saitoha vanished. Receives security patches, accepts PR's filed preferably here but also at saitoha/libsixel.

License

Notifications You must be signed in to change notification settings

libsixel/libsixel

 
 

Repository files navigation

libsixel

logo

Build Status

This is a fork

This is a fork with various improvements and security patches. Hayaki Saito, the project's originator and long-time maintainer, disappeared in 1/2020. It's unknown what happened to him, he no longer even posts on Twitter. This is a continuation by the community. Fredrick R. Brennan (@ctrlcctrlv) is lead maintainer. For more information see saitoha/libsixel issue №154.

What is this?

This package provides a C encoder/decoder implementation for DEC SIXEL graphics in the libsixel.so shared library, and two converter programs, img2sixel and sixel2png.

img2sixel(https://youtu.be/0SasrQ7pnbA)

SIXEL is one of image formats for printer and terminal imaging introduced by Digital Equipment Corp. (DEC). Its data scheme is represented as a terminal-friendly escape sequence. So if you want to view a SIXEL image file, all you have to do is "cat" it to your terminal.

On 80's real hardware terminals, it tooks unbearable long waiting times to display images.

vt330sixel

But nowdays, with high-speed CPU and broadband network, we got the chance broaden the scope of SIXEL graphics.

SIXEL animation

img2sixel(1) can decode GIF animations as well.

Animation

Projects using SIXEL graphics

gnuplot

  • gnuplot

    Recent versions of gnuplot support the new terminal driver "sixeltek(sixel)" / "sixelgd".

    gnuplot

Ghostscript

  • ghostscript

    You can emit SIXEL images with LN03 / LN50 / LA75 driver.

    example:

      $ gs -q -r100x -dBATCH -dNOPAUSE -sDEVICE=ln03 -sOutputFile=- tiger.eps
    

    GhostScript

ImageMagick

  • ImageMagick

    Recent version of ImageMagick provides SIXEL coder. It's also available over commandline tools.

    ImageMagick

lsix

  • lsix

    Like "ls", but for images. Shows thumbnails in terminal using sixel graphics. lsix

Video streaming

Now Youtube video streaming is available over SIXEL protocol by FFmpeg-SIXEL project.

FFmpeg-SIXEL

Above demo only uses 16 color registers.

SDL integration: Gaming, Virtualization, ...etc.

SDL1.2-SIXEL project makes enable you to operate various GUI applications on the terminal.

You can play "The Battle for Wesnoth" over SIXEL protocol.

SDL1.2-SIXEL WESNOTH

You can run QEMU on SIXEL terminals.

SDL1.2-SIXEL QEMU

SDL1.2-SIXEL can collaborate with XSDL-SIXEL.

SDL1.2-SIXEL XSDL

Furthermore some information of SIXEL-ready SDL applications are reported.

w3m integration

img2sixel(1) can be integrated with Debian's w3m(maintained by Tatsuya Kinoshita) that includes patches for -sixel option derived from code by @arakiken (w3m remoteimg branch).

w3m-sixel

@uobikiemukot's sdump project selected another approach. He wrote a w3mimgdisplay compatible program yaimg-sixel. It also works with ranger.

w3m-yaimg-sixel

X11 on SIXEL terminals

Xsixel is a kdrive server implementation for SIXEL terminals.

Xsixel

Xsixel Blue Print

GNU Screen integration

Arakiken's GNU Screen fork(sixel branch) works with SIXEL-supported applications including above products. This project is now in progress. GUI flavored SIXEL applications will integrated with existing terminal applications on it.

w3m-sixel-screen

sixel-screen

xsixel-screen

See also on youtube.

libsixel running on old hardware

Some NetBSD/OpenBSD users are doing challenging work, showing that SIXEL graphics work on old low-powered machines such as:

OMRON LUNA-II

NetBSD/luna68k (here is OMRON LUNA-II):

mikutterm-netbsd-luna68k

HP9000/425e

NetBSD/hp300 (here is HP9000/425e):

mikutterm-netbsd-hp9000

OMRON LUNA-88K2

OpenBSD/luna88k (here is OMRON LUNA-88K2 MC88100@33MHz):

mikutterm-netbsd-hp9000

sayaka-chan(PHP version) works with libsixel inline-image extension.

SIXEL works with old powerless machines such as NetBSD/x68k (here is SHARP X68030 with 060turbo):

sayaka-chan

SIXEL works even in-kernel console. @isaki68k wrote a patch for ite(4).

ite(4)

Other

screenshot

Includes 2 commands fricas2sixel and latex2sixel.

latex2sixel

Now sixel backend is implemented. See https://github.com/dylanaraps/neofetch/wiki/Image-Backends#sixel

neofetch

Depends on sixel-sys, --converter=sixel option is supported.

termplay

Simple scripts and development environment for realtime edit-previewing for dot, svg, markdown, ...etc. sixelPreviewer

A sixel image dumper, provides pdf previewer.

SIXEL video driver is provided if you build it with --enable-sixel option. (screenshot)

For even more, see Projects using SIXEL.md.

Highlighted features

Improved compression

Former sixel encoders(such as ppmtosixel) are mainly designed for dot-matrix printers. They minimize the amount of printer-head movement distance. But nowadays this method did not represent the best performance for displaying sixel data on terminal emulators. SIXEL data for terminals were found in 80's Usenet, but the technology of how to create them seems to be lost. kmiya's sixel introduces the encoding method which is re-designed for terminal emulators to optimize the overhead of transporting SIXEL with keeping compatibility with former SIXEL terminal. Now libsixel and ImageMagick's sixel coder follow it.

@arakiken, known as the maintainer of mlterm, describes about the way to generate high quality SIXEL, which is adopted by libsixel (https://mlterm.sourceforge.net/libsixel.pdf, in Japanese).

High quality quantization

img2sixel(1) supports color image quantization. It works well even if few number of colors are allowed.

Terminal requirements

If you want to view a SIXEL image, you have to get a terminal which support sixel graphics. Many terminals have support, such as mlterm and iTerm2. xterm is a commonly installed Linux terminal with support if ran as xterm -xrm "XTerm*decTerminalID: vt340" -xrm "XTerm*numColorRegisters: 256". For a complete list of supported terminals, see Supported terminals.md.

Install

Using package managers

You can install libsixel via the following package systems.

Build from source package

As of libsixel 2.0, Meson is used to build, not GNU Autotools.

$ meson setup build
$ meson install -C build

Build with optional packages

You can use the following options at build time to influence the build. During the meson build step, pass e.g. -Dlibcurl=enabled to enable cURL.

Option name Former GNU Autotools equivalent Description Default?
img2sixel --enable-img2sixel Build binary img2sixel Yes
sixel2png --enable-sixel2png Build binary sixel2png Yes
gdk-pixbuf2 --with-gdk-pixbuf2 Whether to build in gdk-pixbuf2 support No
gd --with-gd Whether to build in gd support (adds more image formats) Auto
libcurl --with-libcurl build with cURL (allows input filenames to binaries/API to be URLs) No
jpeg --with-jpeg Whether to build with libjpeg support Auto
png --with-png Whether to build with libpng support Auto
gcov --enable-gcov Build gcov coverage tests No
tests --enable-tests Build tests (requires bash) No
python3 --enable-python Build Python library integration No
pkg_config_path --with-pkgconfigdir pkg-config search directory Set by Meson

As well, several directories can be configured, most importantly prefix. Non-standard directories you can change are bashcompletiondir and zshcompletiondir.

Note: Before libsixel 2.0, Python was installed by default. This was disabled because it requires root on most systems for the Python module to be discoverable. Pass -Dpython3=enabled to install it.

Usage of command line tools

See Command line tools.md.

Examples

The following three example projects are distributed in the examples/ directory:

OpenGL

OpenGL example suggests how to port your OpenGL application to a SIXEL-supporting terminal.

opengl example

Drawing

Drawing example suggests how to implement drawing with the mouse in SIXEL-supporting terminals.

drawing

Python

Python example suggests how to convert PIL images into SIXEL graphics using libsixel's Python interface.

APIs

APIs are provided for C, Python, Perl, PHP, and Ruby. For documentation of the C API, see the file md/C API.md, or its header, sixel.h. For documentations of the APIs for scripting languages, see the README for them in their respective directories.

Bindings

Support

This software is provided "as is" without express or implied warranty. The main support channel for this software is its GitHub issue tracker:

https://github.com/libsixel/libsixel/issues

Please post an issue if you have any problems, questions or suggestions.

License

libsixel is MIT-licensed. See the LICENSE file. For licenses of vendorized code, see the files in the licenses directory.

For a list of authors, see the AUTHORS file.

Contributing

  1. Fork the project (https://github.com/libsixel/libsixel/fork/)
  2. Pull (git clone <your URL>)
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Make your changes and add your changed files (git add ...)
  5. Commit your changes (git commit -am 'Add some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create a new Pull Request

Acknowledgments

See Acknowledgements.md.

Other implementations and similar software

See Other implementations.md.

About

A C language SIXEL encoder/decoder implementation, forked from saitoha/libsixel after @saitoha vanished. Receives security patches, accepts PR's filed preferably here but also at saitoha/libsixel.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 87.2%
  • Python 3.5%
  • C++ 3.4%
  • Shell 2.4%
  • Roff 1.4%
  • Meson 0.8%
  • Other 1.3%