IMG2SIXEL(1)

πŸ“¦
version 1.10.5 Β· 2 versions
  • 1.10.5 Β· alpine 3.24, arch rolling, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute (latest)
  • 1.8.7-r2 Β· ubuntu stonking
, in alpine 3.24, arch rolling, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute

πŸ‘‘ IMG2SIXEL(1) β€” General Commands Manual, but make it cute πŸ’…

okay bestie, gather round 🫢 you just opened img2sixel(1), the group chat where your random lil images get turned into gorgeous DEC SIXEL graphics. no cap, this is the good stuff. let's go ✨


🌸 NAME 🌸

img2sixel β€” image converter to DEC SIXEL graphics. that's it, that's the whole vibe πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

img2sixel [ -options ] imagefiles
img2sixel [ -options ] < imagefiles

πŸ’– DESCRIPTION πŸ’–

img2sixel converts various images into high quality DEC SIXEL image format. iconic behavior, honestly πŸ‘‘


✨ COMMAND-LINE OPTIONS ✨

img2sixel has the following command-line options, and yes, we're going through all of them, no skipping 🧚

  • -o, --outfile β€” specify output file name (default: stdout). so if you don't say anything, it just yells into your terminal, main character energy 🌈
  • -7, --7bit-mode β€” generate a sixel image for 7bit terminals or printers (this is the default, she's the moment).
  • -8, --8bit-mode β€” generate a sixel image for 8bit terminals or printers.
  • -R, --gri-limit β€” limit arguments of DECGRI('!') to 255.
  • -p COLORS, --colors=COLORS β€” specify number of colors to reduce the image to (default=256).
  • -m FILE, --mapfile=FILE β€” transform image colors to match this set of colors (the og manpage has a lil typo here and says "colorsspecify map", but you get it πŸ’– specify the map, bestie).
  • -e, --monochrome β€” output monochrome sixel image. this option assumes the terminal background color is black.
  • -k, --insecure β€” allow to connect to SSL sites without certs (enabled only when configured with --with-libcurl). bestie this is the "we're going in without a helmet" flag 😭
  • -i, --invert β€” assume the terminal background color is white. make sense only when -e option is given.
  • -I, --high-color β€” output 15bpp sixel image. she's fancy πŸ’…
  • -u, --use-macro β€” use DECDMAC and DEVINVM sequences to optimize GIF animation rendering.
  • -n MACRONO, --macro-number=MACRONO β€” specify an number argument for DECDMAC and make terminal memorize SIXEL image. No image is shown if this option is specified πŸ‘€ (yes, it just memorizes, it does NOT show you anything).
  • -C COMPLEXIONSCORE, --complexion-score=COMPLEXIONSCORE β€” specify an number argument for the score of complexion correction. COMPLEXIONSCORE must be 1 or more.
  • -g, --ignore-delay β€” render GIF animation without delay. zero patience, we love that.
  • -S, --static β€” render animated GIF as a static image.
  • -d DIFFUSIONTYPE, --diffusion=DIFFUSIONTYPE β€” choose diffusion method which used with color reduction. DIFFUSIONTYPE is one of them:
    • auto β€” choose diffusion type automatically (default)
    • none β€” do not diffuse
    • fs β€” Floyd-Steinberg method
    • atkinson β€” Bill Atkinson's method
    • jajuni β€” Jarvis, Judice & Ninke
    • stucki β€” Stucki's method
    • burkes β€” Burkes' method
    • a_dither β€” positionally stable arithmetic dither
    • x_dither β€” positionally stable arithmetic xor based dither
  • -f FINDTYPE, --find-largest=FINDTYPE β€” choose method for finding the largest dimension of median cut boxes for splitting, make sense only when -p option (color reduction) is specified. FINDTYPE is one of them:
    • auto β€” choose finding method automatically (default)
    • norm β€” simply comparing the range in RGB space
    • lum β€” transforming into luminosities before the comparison
  • -s SELECTTYPE, --select-color=SELECTTYPE β€” choose the method for selecting representative color from each median-cut box, make sense only when -p option (color reduction) is specified. SELECTTYPE is one of them:
    • auto β€” choose selecting method automatically (default)
    • center β€” choose the center of the box
    • average β€” calculate the color average into the box
    • histogram β€” similar with average but considers color histogram
  • -c REGION, --crop=REGION β€” crop source image to fit the specified geometry. REGION should be formatted as '%dx%d+%d+%d'.
  • -w WIDTH, --width=WIDTH β€” resize image to specified width. WIDTH is represented by the following syntax:
    • auto β€” preserving aspect ratio (default)
    • <number>% β€” scale width with given percentage
    • <number> β€” scale width with pixel counts
    • <number>px β€” scale width with pixel counts
  • -h HEIGHT, --height=HEIGHT β€” resize image to specified height. HEIGHT is represented by the following syntax:
    • auto β€” preserving aspect ratio (default)
    • <number>% β€” scale height with given percentage
    • <number> β€” scale height with pixel counts
    • <number>px β€” scale height with pixel counts
  • -r RESAMPLINGTYPE, --resampling=RESAMPLINGTYPE β€” choose resampling method used with -w or -h option (scaling). RESAMPLINGTYPE is one of them:
    • nearest β€” Nearest-Neighbor method
    • gaussian β€” Gaussian filter
    • hanning β€” Hanning filter
    • hamming β€” Hamming filter
    • bilinear β€” Bilinear filter (default)
    • welsh β€” Welsh filter
    • bicubic β€” Bicubic filter
    • lanczos2 β€” Lanczos-2 filter
    • lanczos3 β€” Lanczos-3 filter
    • lanczos4 β€” Lanczos-4 filter
  • -q QUALITYMODE, --quality=QUALITYMODE β€” select quality of color quanlization. QUALITYMODE is one of them:
    • auto β€” decide quality mode automatically (default)
    • high β€” high quality and low speed mode
    • low β€” low quality and high speed mode
    • full β€” quality and careful speed mode
  • -l LOOPMODE, --loop-control=LOOPMODE β€” select loop control mode for GIF animation.
    • auto β€” honer the setting of GIF header (default)
    • force β€” always enable loop
    • disable β€” always disable loop
  • -t PALETTETYPE, --palette-type=PALETTETYPE β€” select palette color space type.
    • auto β€” choose palette type automatically (default)
    • hls β€” use HLS color space
    • rgb β€” use RGB color space
  • -b BUILTINPALETTE, --builtin-palette=BUILTINPALETTE β€” select built-in palette type
    • xterm16 β€” X default 16 color map
    • xterm256 β€” X default 256 color map
    • vt340mono β€” VT340 monochrome map
    • vt340color β€” VT340 color map
  • -E ENCODEPOLICY, --encode-policy=ENCODEPOLICY β€” select encoding policy
    • auto β€” choose encoding policy automatically (default)
    • fast β€” encode as fast as possible
    • size β€” encode to as small sixel sequence as possible
  • -B BGCOLOR, --bgcolor=BGCOLOR β€” specify background color. BGCOLOR is represented by the following syntax:
    • #rgb
    • #rrggbb
    • #rrrgggbbb
    • #rrrrggggbbbb
    • rgb:r/g/b
    • rgb:rr/gg/bb
    • rgb:rrr/ggg/bbb
    • rgb:rrrr/gggg/bbbb
  • -P, --penetrate β€” penetrate GNU Screen using DCS pass-through sequence.
  • -D, --pipe-mode β€” [[deprecated]] read source images from stdin continuously. > she's deprecated bestie, still here, still works, but the manpage literally brackets it in [[deprecated]] so mind that πŸ’€
  • -v, --verbose β€” show debugging info.
  • -V, --version β€” show version and license info.
  • -H, --help β€” print help.

🌿 ENVIRONMENT VARIABLES 🌿

ok so the manpage literally says "img2sixel has the following command-line options:" right here in the environment variables section 😭 that's a typo moment, these are env vars, but we're keeping the info exactly. img2sixel has the following:

  • SIXEL_BGCOLOR β€” specify background color. overrided by -B(--bgcolor) option. represented by the following syntax:
    • #rgb
    • #rrggbb
    • #rrrgggbbb
    • #rrrrggggbbbb
    • rgb:r/g/b
    • rgb:rr/gg/bb
    • rgb:rrr/ggg/bbb
    • rgb:rrrr/gggg/bbbb
  • SIXEL_NCOLORS β€” specify number of colors to reduce the image to (default=256). overrided by -p(--colors) option.

πŸ–ΌοΈ Image loaders πŸ–ΌοΈ

img2sixel includes two or more image decoder components. the roster is stacked, fr fr πŸ”₯

stb_image

libsixel includes stb_image, a public domain image loader. img2sixel uses it as the default built-in image decoder. It can decode almost all images. but a few images can not be decoded by its limitations πŸ˜”

Supported source formats:

  • JPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib)
  • PNG 1/2/4/8/16-bit-per-channel
  • TGA (not sure what subset, if a subset)
  • BMP non-1bpp, non-RLE
  • PSD (composited view only, no extra channels)
  • PIC (Softimage PIC)
  • PNM (PPM and PGM binary only)

Limitations:

  • no 12-bit-per-channel JPEG
  • no JPEGs with arithmetic coding / JPEG 2000
  • no 1-bit BMP

libpng

If libpng library is linked at compile time, img2sixel uses it for decoding PNG image. ✨

libjpeg

If libjpeg library is linked at compile time, img2sixel uses it for decoding JPEG image. ✨

gdk-pixbuf2

If gdk-pixbuf2 library is linked at compile time, img2sixel uses it automatically in some cases.

GD

If GD library is linked at compile time, img2sixel uses it automatically in some cases.

libsixel

img2sixel can load SIXEL as source image format, because it uses libsixel as a SIXEL image decoder. she contains multitudes πŸ’œ


πŸ“œ HISTORY πŸ“œ

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. Encoded SIXEL data for VT-2xx/VT-3xx terminals were found in 80's Usenet, But the technology of how to create them seems to be lost. gone, reduced to atoms 😭

kmiya's sixel(kmiya,2014) introduces an efficient 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. king behavior πŸ‘‘

Araki Ken, known as the maintainer of mlterm, proposed the method for more compressed SIXEL encoding. Now libsixel adopted that method. Araki Ken describes about the way to generate high quality SIXEL.

See http://mlterm.sourceforge.net/libsixel.pdf (in Japanese).


πŸ‘€ SEE ALSO πŸ‘€

sixel(5) sixel2png(1)


🫢 AUTHORS 🫢

img2sixel is maintained by Hayaki Saito. We imported whole code of stb_image v2.12, written by Sean Barrett and its contributers, for loading various images, and imported some code from pnmquant.c (netpbm library) for image quantization. credit where credit is due, periodt πŸ’…


Okay bestie, legal time, but make it cute. πŸŽ€

Copyright (c) 2014-2016 Hayaki Saito

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Like… it's free, it's chill, just don't sue anyone and keep the notice. That's the vibe. ✨


🫢 THANKS 🫢

This software derives from the following implementations. Not me being dramatic, this is literally where it comes from. πŸ’…

  • stb_image-v2.12 β€” This software includes stb_image-v2.12 (stb_image.h), a public domain JPEG/PNG reader. Iconic. No notes. https://github.com/nothings/stb
  • pnmquant.c (netpbm library) β€” The implementation of median cut algorithm for color quantization in quant.c is imported from pnmcolormap included in netpbm library. http://netpbm.sourceforge.net/ β€” and pnmcolormap was derived from ppmquant, originally by Jef Poskanzer.

Copyright (C) 1989, 1991 by Jef Poskanzer.

Copyright (C) 2001 by Bryan Henderson.

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty.

  • sixel 2014-3-2 β€” some part of converters/loader.c are derived from kmiya's "sixel" original version (2014-3-2). http://nanno.dip.jp/softlib/man/rlogin/sixel.tar.gz β€” It is written by kmiya@culti. He distributes it under very permissive license which permits useing, copying, modification, redistribution, and all other public activities without any restrictions. He declares this is compatible with MIT/BSD/GPL.
ngl "useing" is spelled like that in the original and I am not about to touch it, that's the manpage's whole brand now. πŸ’€

πŸ“š REFERENCES πŸ“š


πŸ‘‘ CONTRIBUTORS πŸ‘‘

The absolute icons who made this happen, roll call besties: 🌈

  • Araki Ken (@arakiken)
  • Markus Elfring (@elfring)
  • Akinori Hattori (@hattya)
  • isaki (@isaki68k)
  • NOKUBI Takatsugu (@knok)
  • Yasuhiro MATSUMOTO (@mattn)
  • Masami HIRATA(@msmhrt)
  • OBATA Akio (@obache)
  • Izumi Tsutsui (@tsutsui)
  • Iwamoto Kouichi (@ttdoda)
  • haru (@uobikiemukot)
  • Vertis Sidus (@vrtsds)
  • Bruce Mitchener (@waywardmonkeys)
  • Kazuhiro YOSHIKAWA (@yoshikaw)
  • Turenar <sora@turenar.xyz>
  • Yusuke Endoh <mame@ruby-lang.org>
  • mattn <mattn.jp@gmail.com>
  • Akinori Hattori <hattya@gentoo.org>
  • Øyvind KolΓ₯s <pippin@gimp.org>
  • Henri Salo (@fgeek)
  • hongxu (@HongxuChen)
  • pwd (@YourButterfly)
  • Nicholas Luedtke (@nluedtke)
  • cool-tomato (@cool-tomato)

Every single one of them ate and left no crumbs. πŸ’…


πŸ› BUGS πŸ›

  • Send bug-reports, fixes, enhancements to saitoha@me.com

Found something cursed? Spill it to the email above, bestie, they actually want to know. πŸ’œ


And that's a wrap on IMG2SIXEL(1) from the 4th Berkeley Distribution, dated Aug 2016 ✨ β€” go forth and make your terminal gorgeous, you got this fr fr. πŸ’–πŸŽ€πŸ¦‹