timg - Terminal Image and Video Viewer

timg - Terminal Image and Video Viewer

License: GPL v2   Ubuntu Build macOS Build macOS Brew Building HEAD

https://timg.sh/

A user-friendly viewer that uses 24-Bit color capabilities and unicode character blocks to display images, animations and videos in the terminal.

On terminals that implement the Kitty Graphics Protocol or the iTerm2 Graphics Protocol this displays images in full resolution.

Displays regular images, plays animated gifs, scrolls static images and plays videos.

Useful if you want to have a quick visual check without leaving the comfort of your shell and having to start a bulky image viewer. Sometimes this is the only way if your terminal is connected remotely via ssh. And of course if you don't need the resolution. While icons typically fit pixel-perfect, larger images are scaled down to match the resolution.

The command line accepts any number of image/video filenames that it shows in sequence one per page or in a grid in multiple columns, depending on your choice of --grid. The output is emitted in-line with minimally messing with your terminal, so you can simply go back in history using your terminals' scroll-bar (Or redirecting the output to a file allows you to later simply cat that file to your terminal. Even less -R seems to be happy with it).

Pixelation

On a regular terminal, block-characters are used to output images. Half blocks present pixels color-accurately, and quarter blocks provide a higher spatial resolution at the expense of slightly worse color accuracy. These modes should be compatible with most common terminals that support UTF8 and 24Bit color.

If you are on a Kitty, iTerm2, or wezterm terminal, images can be shown in full resolution.

-p half -p quarter -p kitty or -p iterm2

Grid display

Images can be shown in a grid, which is very useful if you quickly want to sieve through a lot of images. You can choose to show the filename as title, so it is easy to find exactly the filename you're looking for (The following grid uses --grid=2 and is pixelated with -pq).

Grid view of 4 pictures

This is how the same grid looks with Kitty or iTerm2 Graphics mode...

Synopsis

usage: timg [options]  [...]
Options:
        -g
   
    x
    
           : Output geometry in character cells. Terminal is 160x50
        -p
     
       : Pixelation: 'h' = half blocks    'q' = quarter blocks
                                     'k' = kitty graphics 'i' = iTerm2 graphics
                         Default: Auto-detect graphics, otherwise 'quarter'.
        --compress     : Only for -pk or -pi: Compress image data. More
                         CPU use for timg, but less bandwidth needed.
        -C, --center   : Center image horizontally.
        -W, --fit-width: Scale to fit width of available space, even if it
                         exceeds height.
        --grid=
      
       [x
       
        ] : Arrange images in a grid (contact sheet). -w
        
          : Wait time between images (default: 0.0). -a : Switch off anti aliasing (default: on). -b
         
           : Background color to use behind alpha channel. Format 'yellow', '#rrggbb', 'auto' or 'none' (default 'auto'). -B
          
            : Checkerboard pattern color to use on alpha. --pattern-size=
           
             : Integer factor scale of the checkerboard pattern. --auto-crop[=
            
             ] : Crop away all same-color pixels around image. The optional pre-crop is the width of border to remove beforehand to get rid of an uneven border. --rotate=
             
               : Rotate according to included exif orientation. or 'off'. Default: exif. --clear : Clear screen first. Optional argument 'every' will clear before every image (useful with -w) -U, --upscale[=i]: Allow Upscaling. If an image is smaller than the available frame (e.g. an icon), enlarge it to fit. Optional parameter 'i' only enlarges in integer steps. -V : Directly use Video subsystem. Don't probe image decoding first (useful, if you stream video from stdin) -I : Only use Image subsystem. Don't attempt video decoding -F, --title : Print filename as title above each image. -f
              
                : Read newline-separated list of image files to show. (Can be provided multiple times.) -o
               
                 : Write to 
                
                  instead of stdout. -E : Don't hide the cursor while showing images. --threads=
                 
                   : Run image decoding in parallel with n threads (Default 2, half #cores on this machine) --color8 : Choose 8 bit color mode for -ph or -pq --version : Print version and exit. -h, --help : Print this help and exit. Scrolling --scroll=[
                  
                   ] : Scroll horizontally (optionally: delay ms (60)). --delta-move=
                   
                     : delta x and delta y when scrolling (default:1:0) For Animations, Scrolling, or Video These options influence how long/often and what is shown. --loops=
                    
                      : Number of runs through a full cycle. -1 means 'forever'. If not set, videos loop once, animated images forever unless there is more than one file to show. --frames=
                     
                      : Only show first num frames (if looping, loop only these) -t
                      
                        : Stop after this time, independent of --loops or --frames 
                      
                     
                    
                   
                  
                 
                
               
              
             
            
           
          
         
        
       
      
     
    
   

Examples

/tmp/allimg.txt ; timg -f /tmp/allimg.txt # Show a PDF document, use full width of terminal, trim away empty border timg -W --auto-crop some-document.pdf timg --frames=1 some-document.pdf # Show a PDF, but only first page # Reading images from a pipe. The filename '-' means 'read from stdin. # In this example generating a QR code and have timg display it: qrencode -s1 -m2 "http://timg.sh/" -o- | timg - # Open an image from a URL. URLs are internally actually handled by the # video subsystem, so it is treated as a single-frame 'film', nevertheless, # many image-URLs just work. But some image-specific features, such as trimming # or scrolling, won't work. timg --center https://i.kym-cdn.com/photos/images/newsfeed/000/406/282/2b8.jpg # Sometimes, it is necessary to manually crop a few pixels from an # uneven border before the auto-crop finds uniform color all-around to remove. # For example with --auto-crop=7 we'd remove first seven pixels around an image, # then do the regular auto-cropping. # # The following example loads an image from a URL; --auto-crop does not work with # that, so we have to get the content manually, e.g. with wget. Piping to # stdin works; in the following example the stdin input is designated with the # special filename '-'. # # For the following image, we need to remove 3 pixels all around before # auto-crop can take over removing the remaining whitespace successfully: wget -qO- https://imgs.xkcd.com/comics/a_better_idea.png | timg --auto-crop=3 - timg multi-resolution.ico # See all the bitmaps in multi-resolution icons-file timg --frames=1 multi-resolution.ico # See only the first bitmap in that file timg some-video.mp4 # Watch a video. # Play content of webcam (This assumes video4linux2, but whatever input devices # are supported on your system with libavdevice-dev) timg /dev/video0 # If you read a video from a pipe, it is necessary to skip attempting the # image decode first as this will consume bytes from the pipe. Use -V option. youtube-dl -q -o- -f'[height<480]' 'https://youtu.be/dQw4w9WgXcQ' | timg -V - # Show animated gif, possibly limited by timeout, loops or frame-count timg some-animated.gif # show an animated gif forever (stop with Ctrl-C) timg -t5 some-animated.gif # show animated gif for 5 seconds timg --loops=3 some-animated.gif # Loop animated gif 3 times timg --frames=3 --loops=1 some-animated.gif # Show only first three frames timg --frames=1 some-animated.gif # Show only first frame. Static image. # Scroll timg --scroll some-image.jpg # scroll a static image as banner (stop with Ctrl-C) timg --scroll=100 some-image.jpg # scroll with 100ms delay # Create a text with the ImageMagick 'convert' tool and send to timg to scroll convert -size 1000x60 xc:none -fill red -gravity center -pointsize 42 \ -draw 'text 0,0 "Watchen the blinkenlights..."' -trim png:- \ | timg --scroll=20 - # Scroll direction. Horizontally, vertically; how about diagonally ? timg --scroll --delta-move=1:0 some-image.jpg # scroll with dx=1 and dy=0, so horizontally. timg --scroll --delta-move=-1:0 some-image.jpg # scroll horizontally in reverse direction. timg --scroll --delta-move=0:2 some-image.jpg # vertical, two pixels per step. timg --scroll --delta-move=1:1 some-image.jpg # diagonal, dx=1, dy=1 # Background color for transparent images (SVG-compatible strings are supported) # and generally useful if you have a transparent PNG that is otherwise hard # to see on your terminal background. timg -b auto some-transparent-image.png # use terminal background if possible timg -b none some-transparent-image.png # Don't use blending timg -b lightgreen some-transparent-image.png timg -b 'rgb(0, 255, 0)' some-transparent-image.png timg -b '#0000ff' some-transparent-image.png # Checkerboard/Photoshop-like background on transparent images timg -b lightgray -B darkgray some-transparent-image.png # .. with adjustable size. timg -b lightgray -B darkgray --pattern-size=4 some-transparent-image.png ">
timg some-image.jpg                # display a static image
timg -g50x50 some-image.jpg        # display image fitting in box of 50x50 pixel

# Multiple images
timg *.jpg                         # display all *.jpg images
timg --title *.jpg                 # .. show name in title (short option -F)
timg --grid=3x2 *.jpg              # arrange in 3 columns, 2 rows in terminal
timg --fit-width --grid=3 *.jpg    # maximize use of column width (short: -W)
timg --grid=3 -t5 *.gif            # Load gifs one by one in grid. Play each for 5sec.

# Putting it all together; making an alias to list images; let's call it ils = 'image ls'
# This prints images two per row with a filename title. Only showing one frame
# so for animated gifs only the first frame is shown statically.
# With hi-res iTerm or Kitty terminals, consider more columns, e.g --grid=4x1
# Put this line in your ~/.bashrc
alias ils='timg --grid=2x1 --upscale=i --center --title --frames=1 '

# ... using this alias on images outputs a useful column view
ils *.jpg *.gif

# Read the list of images to load from a file. One filename per line.
locate "*.jpg" > /tmp/allimg.txt ; timg -f /tmp/allimg.txt

# Show a PDF document, use full width of terminal, trim away empty border
timg -W --auto-crop some-document.pdf
timg --frames=1 some-document.pdf    # Show a PDF, but only first page

# Reading images from a pipe. The filename '-' means 'read from stdin.
# In this example generating a QR code and have timg display it:
qrencode -s1 -m2 "http://timg.sh/" -o- | timg -

# Open an image from a URL. URLs are internally actually handled by the
# video subsystem, so it is treated as a single-frame 'film', nevertheless,
# many image-URLs just work. But some image-specific features, such as trimming
# or scrolling, won't work.
timg --center https://i.kym-cdn.com/photos/images/newsfeed/000/406/282/2b8.jpg

# Sometimes, it is necessary to manually crop a few pixels from an
# uneven border before the auto-crop finds uniform color all-around to remove.
# For example with --auto-crop=7 we'd remove first seven pixels around an image,
# then do the regular auto-cropping.
#
# The following example loads an image from a URL; --auto-crop does not work with
# that, so we have to get the content manually, e.g. with wget. Piping to
# stdin works; in the following example the stdin input is designated with the
# special filename '-'.
#
# For the following image, we need to remove 3 pixels all around before
# auto-crop can take over removing the remaining whitespace successfully:
wget -qO- https://imgs.xkcd.com/comics/a_better_idea.png | timg --auto-crop=3 -

timg multi-resolution.ico   # See all the bitmaps in multi-resolution icons-file
timg --frames=1 multi-resolution.ico  # See only the first bitmap in that file

timg some-video.mp4         # Watch a video.

# Play content of webcam (This assumes video4linux2, but whatever input devices
# are supported on your system with libavdevice-dev)
timg /dev/video0

# If you read a video from a pipe, it is necessary to skip attempting the
# image decode first as this will consume bytes from the pipe. Use -V option.
youtube-dl -q -o- -f'[height<480]' 'https://youtu.be/dQw4w9WgXcQ' | timg -V -

# Show animated gif, possibly limited by timeout, loops or frame-count
timg some-animated.gif      # show an animated gif forever (stop with Ctrl-C)
timg -t5 some-animated.gif                   # show animated gif for 5 seconds
timg --loops=3 some-animated.gif             # Loop animated gif 3 times
timg --frames=3 --loops=1 some-animated.gif  # Show only first three frames
timg --frames=1 some-animated.gif            # Show only first frame. Static image.

# Scroll
timg --scroll some-image.jpg       # scroll a static image as banner (stop with Ctrl-C)
timg --scroll=100 some-image.jpg   # scroll with 100ms delay

# Create a text with the ImageMagick 'convert' tool and send to timg to scroll
convert -size 1000x60 xc:none -fill red -gravity center -pointsize 42 \
        -draw 'text 0,0 "Watchen the blinkenlights..."' -trim png:-   \
      | timg --scroll=20 -

# Scroll direction. Horizontally, vertically; how about diagonally ?
timg --scroll --delta-move=1:0 some-image.jpg  # scroll with dx=1 and dy=0, so horizontally.
timg --scroll --delta-move=-1:0 some-image.jpg # scroll horizontally in reverse direction.
timg --scroll --delta-move=0:2 some-image.jpg  # vertical, two pixels per step.
timg --scroll --delta-move=1:1 some-image.jpg  # diagonal, dx=1, dy=1

# Background color for transparent images (SVG-compatible strings are supported)
# and generally useful if you have a transparent PNG that is otherwise hard
# to see on your terminal background.
timg -b auto some-transparent-image.png  # use terminal background if possible
timg -b none some-transparent-image.png  # Don't use blending
timg -b lightgreen some-transparent-image.png
timg -b 'rgb(0, 255, 0)' some-transparent-image.png
timg -b '#0000ff' some-transparent-image.png

# Checkerboard/Photoshop-like background on transparent images
timg -b lightgray -B darkgray some-transparent-image.png

# .. with adjustable size.
timg -b lightgray -B darkgray --pattern-size=4 some-transparent-image.png
Partially transparent icon on champagne-colored terminal emulator
-b auto -b lightgreen -b lightgreen -B yellow -b none
--pattern-size=1 --pattern-size=4

Include in file browsers

There are many terminal based file-browsers. Adding timg to their configuration is usually straight forward.

# Another use: can run use this in a fzf preview window:
echo some-image.jpg | fzf --preview='timg -E --frames=1 --loops=1 -g $(( $COLUMNS / 2 - 4 ))x$(( $FZF_PREVIEW_LINES * 2 )) {}'

# Use in vifm. ~/.config/vifm/vifmrc
filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
         \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,
         \*.as[fx]
        \ {View in timg}
        \ timg --title --center --clear %f,

filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
        \ {View in timg}
        \ timg --title --center --clear %f; read -n1 -s -r -p "Press any key to return",

Other fun things

# Also, you could store the output and cat later to your terminal...
timg -g80x40 some-image.jpg > /tmp/imageout.txt
cat /tmp/imageout.txt

# Of course, you can redirect the output to somewhere else. I am not suggesting
# that you rickroll some terminal by redirecting timg's output to a /dev/pts/*
# you have access to, but you certainly could...

# Of course, you can go really crazy by storing a cycle of an animation. Use xz
# for compression as it seems to deal with this kind of stuff really well:
timg -g60x30 --loops=10 nyan.gif | xz > /tmp/nyan.term.xz

# ..now, replay the generated ANSI codes on the terminal. Since it would
# rush through as fast as possible, we have to use a trick to wait between
# frames: Each frame has a 'move cursor up' escape sequence that contains
# an upper-case 'A'. We can latch on that to generate a delay between frames:
xzcat /tmp/nyan.term.xz | gawk '/\[.*A/ { system("sleep 0.1"); } { print $0 }'

# You can wrap all that in a loop to get an infinite repeat.
while : ; do xzcat... ; done

# (If you Ctrl-C that loop, you might need to use 'reset' for terminal sanity)

Terminal considerations

This section contains some details that you only might need to ever look at if the output is not as expected.

Half block and quarter block rendering

The half block pixelation (-p half) uses the the unicode character [▄](U+2584 - 'Lower Half Block') or [▀](U+2580 - 'Upper Half Block') (depending on the TIMG_USE_UPPER_BLOCK environment variable). If the top and bottom color is the same, a simple space with background color is used.

The quarter block pixelation (-p quarter) uses eight different blocks.

With both of these pixelations, choosing the foreground color and background 24-bit color, timg can simulate 'pixels'. With the half-block pixelation, this can assign the correct color to the two 'pixels' available in one character cell, in the quarter pixelation, four 'pixels' have to share two colors, so the color accuracy is slighlty worse but it allows for higher spatial resolution.

The -p command line flag allows to choose between -p half, -p quarter, also possible to just shorten to -ph and -pq. Default is -pq (see above how this looks like).

Terminals that don't support Unicode or 24 bit color will probably not show a very pleasent output. For terminals that only do 8 bit color, use the --color8 command line option.

Some terminals support direct image output

The Kitty, iTerm2, and wezterm terminals have a special feature that allows for directly displaying high-resolution pictures. If timg is running in such a terminal, it will automatically use that mode. (You can choose Kitty mode explicitly with -pk, iTerm and wezterm mode with -pi).

All the features with arranging images (center, grid, adding titles) or transparency settings behave exactly the same.

Note, if watching videos remotely with this is too slow (due to high bandwidth requirements or simply because your terminal has to do more work), try setting the environment variable TIMG_ALLOW_FRAME_SKIP=1 to allow timg leaving out frames to stay on track (see man timg, environment variable section).

Half block: Choice of rendering block

By default, timg uses the 'lower half block' to show the pixels in -p half mode. Depending on the font the terminal is using, using the upper block might look better, so it is possible to change the default with an environment variable. Play around with this value if the output looks poor on your terminal. I found that on my system there is no difference for konsole or xterm but the cool-retro-term looks better with the lower block, this is why it is the default.

In some terminals, such as alacritty (and only with certain font sizes), there seems to be the opposite working better. To change, set this environment variable:

export TIMG_USE_UPPER_BLOCK=1   # change default to use upper block.

(this only will work fully with -p half. In -p quarter mode, there are additional blocks that can't be worked around)

What a problematic choice of block looks like

The image generally looks a bit 'glitchy' if the terminal leaves little space between blocks, so that the wrong background color shows on a single line between pixels. This is likely not intended by the terminal emulator and possibly happening on rounding issues of font height or similar.

Anyway, we can work around it (fully in -p half, partially in -p quarter mode). In the following illustration you see how that looks like. If you see that, change the TIMG_USE_UPPER_BLOCK environment variable.

Glitchy. Change TIMG_USE_UPPER_BLOCK Looks good

Other artifacts

Some terminals leave one pixel of horizontal space between characters that result in fine vertical lines in the image. That can't be worked around, send a bug or better pull request to your terminal emulator.

Wrong font aspect ratio

Usually, timg attempts to determine the font aspect ratio and apply some correction if it is off from the nominal 1:2. But if you notice that the image displayed is not quite the right aspect ratio because of the terminals font used, you can set an environment variable TIMG_FONT_WIDTH_CORRECT with a factor to make it look correctly.

Increasing the visual width by 10% would be setting the value to 1.1 for instance.

export TIMG_FONT_WIDTH_CORRECT=1.1
timg myimage.jpg

This is an environment variable, so that you can set it once to best fit your terminal emulator of choice and don't have to worry about later.

Example
Terminal font too narrow Correct. Here with TIMG_FONT_WIDTH_CORRECT=1.375

Tested terminal emulators

(Needs update; these comparisons are from 2016 when I tested this last with timg, so newer terminals are probably even better).

Tested terminals: konsole >= 2.14.1, gnome-terminal > 3.6.2 look good, recent xterms also seem to work (albeit with less color richness). Like gnome-terminal, libvte based terminals in general should work, such as Xfte or termite. Also QTerminal is confirmed working.

Linux console seems to be limited in colors and does not show the block character - if you know how to enable the unicode character or full color there, please let me know.

For Mac users, at least the combination of macOS 11.2 and iTerm2 3.4.3 works.

Install pre-built package

Debian-based systems

sudo apt install timg

(currently in Debian testing)

NixOS or Nix package manager

nix-env -iA nixpkgs.timg

macOS

brew install timg

Linux distributions that support snap packages

If you have enabled support for snap packages in your Linux distribution, you can install timg with

sudo snap install timg

Build from source

Get dependencies on Debian/Ubuntu

sudo apt install cmake git g++ pkg-config
sudo apt install libgraphicsmagick++-dev libturbojpeg-dev libexif-dev libswscale-dev # needed libs

# If you want to include video decoding, also install these additional libraries
sudo apt install libavcodec-dev libavformat-dev

sudo apt install libavdevice-dev # If you want to read from video devices such as v4l2

sudo apt install libopenslide-dev # If you want to add OpenSlide images support

sudo apt install pandoc  # If you want to recreate the man page

Get dependencies on NixOS or Nix package manager

The dependencies are set-up in the shell.nix, so you're ready to go opening a nix shell

nix-shell

Get dependencies on macOS

# Homebrew needs to be available to install required dependencies
brew install cmake git GraphicsMagick webp jpeg-turbo libexif  # needed libs

# Work around glitch in pkg-config and jpeg-turbo.
brew unlink jpeg && brew link --force jpeg-turbo

# If you want to include video decoding, install these additional libraries
brew install ffmpeg

# If you want to add OpenSlide images support
brew install openslide

brew install pandoc  # If you want to recreate the man page

Get repo and compile timg

In the script below you see that the build system allows for some compile-time choices:

  • WITH_VIDEO_DECODING allow for video decoding. Requires ffmpeg-related libraries. You typically want this ON (default)
    • WITH_VIDEO_DEVICE this allows for accessing connected video devices, e.g. you can watch your webcam input (requires WITH_VIDEO_DECODING).
  • WITH_GRAPHICSMAGICK This is the main image loading library so you typically want this ON (default).
  • WITH_TURBOJPEG If enabled, uses this for faster jpeg file loading. You typically want this ON (default).
  • WITH_OPENSLIDE_SUPPORT Openslide is an image format used in scientific applications. Default off, switch ON if needed.
  • WITH_STB_IMAGE Compile the simpler STB image library directly into the timg binary in cases where Graphicsmagick is not suitable for dependency pruning reasons; output can be slower and of less quality. You typically want this OFF (default) if you can use Graphicsmagick.

You can choose these options by providing -D on the cmake command line, see below.

git clone https://github.com/hzeller/timg.git  # Get repo
cd timg  # Enter the checked out repository directory.
mkdir build  # Generate a dedicated build directory.
cd build
# WITH_VIDEO_DECODING enables video; WITH_VIDEO_DEVICE reading from webcam
# WITH_OPENSLIDE_SUPPORT enables support to OpenSlide images
cmake ../ -DWITH_VIDEO_DECODING=On -DWITH_VIDEO_DEVICE=On -DWITH_OPENSLIDE_SUPPORT=On
make

Install

You can run timg directly in the build directory using src/timg. To install the binary and manpage on your system, type in the build directory:

sudo make install
Owner
Henner Zeller
Code Poet, Photographer, Artist, Maker.
Henner Zeller
Comments
  • Respect SVG transparency

    Respect SVG transparency

    When viewing an SVG image, a white background is added. This is probably due to the default of ImageMagick which can be changed with the flag -background none :)

  • Is CMAKE >= 3.13 really necessary? Refuses to build on Ubuntu 18.04

    Is CMAKE >= 3.13 really necessary? Refuses to build on Ubuntu 18.04

    I'm aware the CMake build was just recently added to the project. But requiring 3.13 is very strict! Ubuntu 18.04, which is still in half its lifetime, ships with 3.10.2. Possibly the same happens in many other distros that are still supported.

    Is the build script actually using any CMake features that are not available in 3.10? Is it possible for you guys to downgrade it, so it would build-able out-of-the-box by anyone? Sure, I can edit CMakeLists.txt myself, but that misses the point.

    CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
      CMake 3.13 or higher is required.  You are running version 3.10.2
    
    
    -- Configuring incomplete, errors occurred!
    
  • Remove makefile

    Remove makefile

    This is how it looks like when removing the Makefile (made an extra branch so it is not entangled)

    Missing is updating README.md

    PS: I've added "DISTRIBUTION_VERSION" to the version so that distributions can ammend the version, which is maybe useful to determine where a bug report came from. Though there is no automatic detection, distribution needs to add that information in their build process)

  • CMake build system.

    CMake build system.

    Hi @hzeller,

    I could not resist and have a peek at the project, and in preparation for Debian inclusion I've hacked together CMake integration.

    My selfish motivations: While Makefiles for works nice, my experience shows that with the many architectures Debian supports this tends to be more fragile.

    I've tries hard to have CMake nehave exactly as src/Makefile… However, here are differences:

    • when the version information can be retrieved from git, the timestamp is according ISO8601, not only the date. As side effect, one can see if it as cmake or makefile build:))
    • The version generation can be turned off with a CMake option -- useful when a distribution does package from a git repo unrelated to the upstream git repo.)
    • if the manpage is regenerated, the manpage is not compressed. )

    The change in the Makefile makes sure that the CMake and Makefile can coexists; if you think Makefile suppor is not needed, I can simply stuff a bit. Just let me know.

    Cheers, tobi

  • How to put this forward for inclusion in Linux distros?

    How to put this forward for inclusion in Linux distros?

    I'm not familiar with how the process works to get software included in Linux distros, but little gem would be at the top of my list. It's small, portable and feels like a fundamental CLI tool to have on all systems.

    I'd like to try but not sure where to start - a quick web search didn't help with that either.

    Anyone have any ideas?

  • Support `-p b` for using background colours and/or reverse video

    Support `-p b` for using background colours and/or reverse video

    For low-fidelity output, \e[48;5;…m or \e[7;38;5;…m is more likely to produce better-looking results than Unicode block characters. Here's how I'd do it:

    $ timg --pixelation=b 1px-solid-red.png | sed s/$'\e'/\\\\e/g
    \e[7;38;2;255;0;0m \e[27;39m
    

    Now, I know the readme says this:

    Terminals that don't support Unicode or 24 bit color are not supported; they will probably not show a very pleasent output.

    … so this rendering mode should emit 2 characters instead of 1 (possibly configurable with an option or environment variable):

    Actual image
    (4×5 @ 1700%)
    Enlarged version
    (with pixel boundaries)
    With 1 character
    Pixel ratio: 1.0
    With 2 characters
    Pixel ratio: 2.0
    H (4×5px) H (4×5px)
    █  █
    █  █
    ████
    █  █
    █  █
    ██    ██
    ██    ██
    ████████
    ██    ██
    ██    ██

    The trade-off is that images take twice as much space to display, but that might be an acceptable compromise if users are happy with scrolling sideways to see the full image (by piping to less -RS), or if they know the image to be small enough to fit their terminal window.

  • Remove black border and artifacts + implement background transparency

    Remove black border and artifacts + implement background transparency

    • FIX: Removed the black border that was used as an workaround to the artifacts that appeared when the terminal scrolled during rendering (actually the artifacts still appeared, but wouldn't be visible on black backgrounds)
    • FEATURE: Background + (optional) checkerboard pattern blending with transparent images, so pixels with opacity < 1.0 won't be completely invisible anymore. See the results below:

    screenshot-2018-04-22t20 16 54-0300 screenshot-2018-04-22t20 22 03-0300

    • EXTRA: Added an .editorconfig file to guarantee codestyle consistency for anyone contributing :)
  • Undefined reference to symbol 'CloneImageInfo'

    Undefined reference to symbol 'CloneImageInfo'

    Hi,

    I can't build, errors are as follows:

    LANG=C make
    g++ -o timg timg.o terminal-canvas.o `GraphicsMagick++-config --ldflags --libs`
    /usr/bin/ld: timg.o: undefined reference to symbol 'CloneImageInfo'
    /usr/lib64/libGraphicsMagick-Q16.so.3: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
    Makefile:7: recipe for target 'timg' failed
    make: *** [timg] Error 1
    

    However:

    readelf -s /usr/lib64/libGraphicsMagick-Q16.so.3| grep -i CloneImageInfo
       544: 00000000000b7120   823 FUNC    GLOBAL DEFAULT   11 CloneImageInfo
    

    Packages versions:

    libwebp-devel-0.5.2-1.fc25.x86_64
    GraphicsMagick-1.3.25-6.fc25.x86_64
    

    SO is: Fedora 25

    Thanks in advance

  • More compact output

    More compact output

    The output of timg could be more compact for the same rendering: the ANSI sequences are generated with useless leading zeroes.

    Here is a simple compressor I'm using as a workaround:

    #!/bin/sed -f
    s/\([;[]\)00*/\1/g
    
  • Stucks on a

    Stucks on a "iOS optimized PNG" file

    timg stucks on a png file in my linux terminal. The file came from a macbook.

    • "display" can open the image correctly.
    • "mediainfo" returns normal information.
    • "ffprode" returns an error message: "inflate returned error -3".
    • "viu" returns an error message: "CgBI chunk appeared before IHDR chunk"

    After some searches, I found a similar question: https://stackoverflow.com/questions/21359540/strange-png-errors-bad-length-for-ihdr-chunk It references to this document finally: https://iphonedev.wiki/index.php/CgBI_file_format

    $ timg --version
    timg 1.4.4+ (Debian package 1.4.4-1+build1) <https://timg.sh/>
    Copyright (c) 2016..2021 Henner Zeller. This program is free software; license GPL 2.0.
    
    Image decoding GraphicsMagick 1.3.38 (2022-03-26)
    Openslide 3.4.1
    Video decoding libav 59.16.100
    
  • Black screen on tmux

    Black screen on tmux

    Hello,

    I'm MB. A very nice and polite guy.

    If I run timg in my rpi with ssh it's fine.

    But if I run it inside a tmux session over ssh it just produces black screens. I'm always inside tmux so I would like to fix that.

    Any idea why that happens and if there is a way to fix it?

    (When I say black screen I mean the output is just a big black square or something like that).

  • Option to show all images at once with `--grid` and `-w`

    Option to show all images at once with `--grid` and `-w`

    When using the grid option in combination with the wait time option to make a slide show, it would be useful to have have an option to show all the images in the grid at once. For example, timg -w5 --grid=2x1 image1.jpg image2.jpg image3.jpg image4.jpg would show image1.jpg and image2.jpg, then wait 5 seconds, then show image3.jpg and image4.jpg in a 2 by 1 grid.

  • Three dependencies for Debian not present in instructions

    Three dependencies for Debian not present in instructions

    Just a quick one. I had to add the following to my fresh debian 11.3 install, to get the build with all the options on, to work:

    sudo apt install libturbojpeg0-dev                                                                                                                                  
    sudo apt install libexif-dev                                                                                                                                                                                               
    sudo apt install libgraphicsmagick++1-dev    
    

    Tried to submit the change to the REAME as a pull request, but can't push the branch.

  • How to install timg in Centos?

    How to install timg in Centos?

    I build timg from source code and the output is as follows. I tried to install the package via yum install libjpeg-turbo, but the error still exists.

    -- The CXX compiler identification is GNU 4.8.5
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1")
    -- Found Git: /usr/bin/git (found version "2.19.1")
    -- Checking for module 'zlib'
    --   Found zlib, version 1.2.7
    -- Checking for module 'libturbojpeg'
    --   No package 'libturbojpeg' found
    CMake Error at /usr/local/lib64/python3.6/site-packages/cmake/data/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):
      A required package was not found
    Call Stack (most recent call first):
      /usr/local/lib64/python3.6/site-packages/cmake/data/share/cmake-3.22/Modules/FindPkgConfig.cmake:825 (_pkg_check_modules_internal)
      CMakeLists.txt:34 (pkg_check_modules)
    
  • Implement timg into links or w3m

    Implement timg into links or w3m

    Hello,

    I'm BM. A very nice and polite guy.

    I like timg. It's a nice package.

    Clearly it can view images in the terminal : )

    So why not implement it into links or w3m? At the moment w3m seems to require xterm to view images. But timg could definitely do the job. Text on top, images on bottom of page or something like that.

    This would be a really cool package for linux and I think a lot of people would like to use a timg enabled terminal browser.

    Please note, I'm talking about Terminal browsers only (text-based).

Related tags
Spitfire is a basic terminal language that can exicute code via the terminal.

Spitfire is a basic terminal language that can exicute code via the terminal. It is easy to learn and runs fast, considering that its just a 300 line c++ file.

Nov 18, 2021
Pipe Viewer - monitor the progress of data through a pipe

Introduction ************ This is the README for `pv' ("Pipe Viewer"), a terminal-based tool for monitoring the progress of data through a pipeline.

Nov 19, 2022
Terminal calculator made for programmers working with multiple number representations, sizes, and overall close to the bits
Terminal calculator made for programmers working with multiple number representations, sizes, and overall close to the bits

Programmer calculator The programmer calculator is a simple terminal tool designed to give maximum efficiency and flexibility to the programmer workin

Nov 22, 2022
The new Windows Terminal and the original Windows console host, all in the same place!

The new Windows Terminal and the original Windows console host, all in the same place!

Dec 8, 2022
A C, C++ and Rust library to draw graphics with pixels in the terminal
A C, C++ and Rust library to draw graphics with pixels in the terminal

A library to draw graphics with pixels in the terminal Who needs a GUI when you have a terminal ? Building To generate libpluto.a, run: $ make To ins

Nov 7, 2022
Small header only C++ library for writing multiplatform terminal applications

Terminal Terminal is small header only library for writing terminal applications. It works on Linux, macOS and Windows (in the native cmd.exe console)

Dec 1, 2022
:computer: C++ Functional Terminal User Interface. :heart:
:computer: C++ Functional Terminal User Interface. :heart:

FTXUI Functional Terminal (X) User interface A simple C++ library for terminal based user interface. Demo: Feature Functional style. Inspired by [1] a

Nov 30, 2022
A little UNIX-inspired terminal application for the Numworks Calculator (not using escher).
A little UNIX-inspired terminal application for the Numworks Calculator (not using escher).

L.E. Terminal (let for short) is a little UNIX-inspired terminal for the Numworks Calculator.

Aug 31, 2022
Draw sequence diagram in text from terminal.

sequence-diagram-cli Draw seqence diagram from terminal.

Nov 26, 2022
X terminal emulator rendering through OpenGL ES Compute Shaders

Zutty is a terminal emulator for the X Window System, functionally similar to several other X terminal emulators such as xterm, rxvt and countless others

Dec 3, 2022
n³ The unorthodox terminal file manager
n³ The unorthodox terminal file manager

n³ The unorthodox terminal file manager

Nov 30, 2022
Graphs the activity of a chia harvester in a linux terminal.
Graphs the activity of a chia harvester in a linux terminal.

Chia Harvest Graph Monitor for Chia Harvesting Introduction The chiaharvestgraph tool will graph Chia Harvesting activity in a linux terminal. Use a 2

Nov 10, 2022
a simple to use linux terminal

a simple to use linux terminal

Feb 17, 2022
Collection of human friendly terminal interface for git.
Collection of human friendly terminal interface for git.

A collection of human friendly terminal user interface for git.

Dec 2, 2022
Simple benchmark for terminal output

TermBench This is a simple timing utility you can use to see how slow your terminal program is at parsing escape-sequence-coded color output. It can b

Dec 4, 2022
tinytetris - 80x23 terminal tetris
tinytetris - 80x23 terminal tetris

tinytetris - 80x23 terminal tetris

Dec 1, 2022
Contour - A modern C++ Terminal Emulator
 Contour - A modern C++ Terminal Emulator

contour is a modern terminal emulator, for everyday use. It is aiming for power users with a modern feature mindset.

Dec 7, 2022
📺🗿 Terminal graphics for the 21st century.
📺🗿 Terminal graphics for the 21st century.

???? Chafa is a command-line utility that converts all kinds of images, including animated GIFs, into sixel or ANSI/Unicode character output that can be displayed in a terminal.

Nov 29, 2022
Simple Unix Terminal Football Manager-like game.

Superleage 2020/2021 It is a "work in progress" simple game based on some mechanics of Football Manager. The game is in a very early stage of Developm

Oct 14, 2021