|
NAMEtimg - A terminal image and video viewerSYNOPSIStimg [<options> <image/video> [<image/video>...]DESCRIPTIONShow images, play animated gifs, scroll static images or play videos in the terminal. Even show PDFs if needed.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 such output). The special filename “-” stands for standard input, so you can read an image from a pipe. If the input from a pipe is a video, use the -V option (see below). Under the hood, timg uses GraphicsMagick to open and decode a wide range of image formats. It also uses libav to decode and play videos or images from files and URLs. With -I or -V you can choose to use only one of these file decoders (GraphicsMagick or libav respectively). OPTIONSGeneral Options
Half blocks have a pixel aspect ratio of about 1:1 and allow to represent colors correctly, but they look more `blocky'. Quarter blocks will have a pixel aspect ratio of 1:2 (timg will stretch the picture accordingly, no worries), and can only represent colors approximately, as the four quadrant sub-pixels can only be foreground or background color. This increases the spatial resolution in x-direction at expense of slight less color accuracy. It makes it look less `blocky' and usually better. There are terminal emulators that allow to display high-resolution pictures. If timg is detecting to run in a Kitty, iTerm2 or WezTerm, the corresponding mode is auto-selected. You can choose the modes explicitly with -pk (Kitty) or -pi (iTerm2 protocol, also implemented by WezTerm). Default is `quarter' unless the terminal is graphics-capable.
As a `special' color, auto is allowed, which attempts to query the terminal for its background color (Best effort; not all terminals support that). If detection fails, the fallback is `black'. The special value none switches off blending background color.
The optional pre-crop is number of pixels to unconditionally trim all around the original image, for instance to remove a thin border. The link in the EXAMPLES section shows an example how this improves showing an xkcd comic with a border.
There is an optional parameter `every' (--clear=every), which will clean the screen before every image. This only makes sense if there is no --grid used and if you allow some time to show the image of course, so good in combination with -w.
By default, larger images are only scaled down and images smaller than the available pixels in the terminal are left at the original size (this helps assess small deliberately pixelated images such as icons in their intended appearance). This option scales up smaller images to fit available space. The long option allows for an optional parameter --upscale=i that forces the upscaling to be in integer increments to keep the `blocky' appearance of an upscaled image without bilinear scale `fuzzing'.
Usually, timg will first attempt to interpret the data as image, but if it that fails, will fall-back to try interpret the file as video. However, if the file is coming from stdin, the first bytes used to probe for the image have already been consumed so the fall-back would fail in that case... Arguably, this should be dealt with automatically but isn’t :) Long story short: if you read a video from a pipe, use -V. See link in EXAMPLES section for a an example.
Absolute filenames in the list are used as-is, relative filenames are resolved relative to the filelist-file itself.
For Animations, Scrolling, or VideoUsually, animations are shown in full in an infinite loop. These options limit infinity.
If not set, videos loop once, animated images forever unless there is more than one file to show. If there are multiple files on the command line, animated images are only shown once if --loops is not set to prevent the output get stuck on the first animation.
Scrolling
RETURN VALUESExit code is
ENVIRONMENT
To display pixels, timg uses a Unicode half block and sets the foreground color and background color to get two vertical pixels. By default, it uses the U+2584 - `Lower Half Block' (▄) character to achieve this goal. This has been chosen as it resulted in the best image in all tested terminals (konsole, gnome terminal and cool-retro-term). So usually, there is no need to change that. But if the terminal or font result in a funny output, this might be worth a try. This is an environment variable because if it turns out to yield a better result on your system, you can set it once in your profile and forget about it.
If you notice that the image displayed is not quite the right aspect ratio because of the font used, you can modify this factor to make it look correct. Increasing the visual width by 10% would be setting it to TIMG_FONT_WIDTH_CORRECT=1.1 for instance. This is an environment variable, so that you can set it once to best fit your terminal emulator of choice.
EXAMPLESSome example invocations including scrolling text or streaming an online video are put together at <https://github.com/hzeller/timg#examples>KNOWN ISSUESThis requires a terminal that can deal with Unicode characters and 24 bit color escape codes. This will be problematic on really old installations or if you want to display images on some limited text console.The option -V should not be necessary for streaming video from stdin; timg should internally buffer bytes it uses for probing. BUGSReport bugs to <http://github.com/hzeller/timg/issues>COPYRIGHTCopyright (c) 2016..2021 Henner Zeller. This program is free software, provided under the GNU GPL version 2.0 or later <https://gnu.org/licenses/gpl.html>.SEE ALSOGraphicsMagick, ffmpeg(1)AUTHORSHenner Zeller.
Visit the GSP FreeBSD Man Page Interface. |