libsixel

repository·master·Indexed 25 days ago

https://github.com/saitoha/libsixel

A lightweight, fast implementation of the DEC SIXEL graphics codec for encoding and decoding images and animations within terminal emulators. It includes the img2sixel command-line utility for image conversion, the sixel2png tool for decoding, and language bindings for Python, Perl, mruby, Rust, and Idris 2. Version v1.8.7-r2.

Tokens
10.5K
Snippets
29
Records
47
Agent score
82%

What's inside libsixel

  1. Overview of libsixel

    master
    libsixel is a library providing encoder/decoder implementations for DEC SIXEL graphics, along with various converter programs. SIXEL is an image format for printers and terminals that uses terminal-friendly escape sequences. This allows users to view SIXEL image files simply by using the cat command to output them to a SIXEL-compatible terminal.
  2. Key Features: Improved Compression and Quantization

    master
    libsixel implements modern SIXEL encoding optimized for terminal emulators rather than dot-matrix printers. This reduces transport overhead while maintaining compatibility with older hardware. Additionally, img2sixel(1) supports high-quality color image quantization, performing well even when restricted to a small number of colors.
  3. Install the libsixel-ruby gem

    master

    You can install the libsixel-ruby gem using Bundler by adding it to your Gemfile, or by installing it directly via the command line. Note that you must have libsixel (version 1.5.0 or higher) installed on your system as a requirement.

    gem 'libsixel-ruby'

    Or via command line:

    $ gem install libsixel-ruby

    Or via bundle:

    $ bundle

  4. Install libsixel-python

    master

    You can install the Python wrapper using one of two methods depending on whether you want to integrate it with a system-wide Python installation or just your current active environment.

    Method 1: Install into a prefixed Python (e.g., /usr/local)

    Use this method if you want to configure the build to include Python support during the main libsixel configuration step.

    Method 2: Install into only the current active Python

    Use this method to install the core libsixel library first, and then install the Python module separately using setup.py.

    Note: Both methods require cloning the repository and running the build process.

    # Example 1: Install into Python prefixed with '/usr/local'
    $ git clone https://github.com/saitoha/libsixel.git
    $ cd libsixel 
    $ ./configure --enable-python --prefix=/usr/local
    $ make install
    
    # Example 2: Install into only current active python
    $ git clone https://github.com/saitoha/libsixel.git
    $ cd libsixel 
    $ ./configure --disable-python
    $ make install
    $ cd python
    $ python setup.py install
  5. Integrate SIXEL with w3m

    master
    You can integrate img2sixel(1) with Debian's w3m using patches for the -sixel option. Alternatively, the yaimg-sixel program (part of the sdump project) is a w3mimgdisplay compatible program that works with ranger.
  6. Configure XTerm for SIXEL graphics support

    master

    To view SIXEL images in XTerm, it must be compiled with the --enable-sixel-graphics option. You must launch XTerm using the -ti vt340 option.

    By default, the SIXEL palette in XTerm is limited to 16 colors. To enable up to 256 colors, use one of the following methods:

    Method 1: Using .Xresources

    $ echo "XTerm*decTerminalID: vt340" >> $HOME/.Xresources
    $ echo "XTerm*numColorRegisters: 256" >>  $HOME/.Xresources
    $ xrdb $HOME/.Xresources
    $ xterm

    Method 2: Using command line flags

    $ xterm -xrm "XTerm*decTerminalID: vt340" -xrm "XTerm*numColorRegisters: 256"
    $ echo "XTerm*decTerminalID: vt340" >> $HOME/.Xresources
    $ echo "XTerm*numColorRegisters: 256" >>  $HOME/.Xresources
    $ xrdb $HOME/.Xresources
    $ xterm