Skip to content

Commit

Permalink
Documentation update
Browse files Browse the repository at this point in the history
 * Point to AppImage
 * Explain constraints of showing images in tmux
  • Loading branch information
hzeller committed Nov 30, 2023
1 parent 4707a40 commit 2c725d9
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 17 deletions.
55 changes: 39 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,12 @@ while : ; do xzcat... ; done
# (If you Ctrl-C that loop, you might need to use 'reset' for terminal sanity)
```

### Terminal considerations
## Terminal considerations

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

#### Many terminals support direct image output
### Many terminals support direct hi-res image output

The [Kitty], [iTerm2], and [wezterm] terminals as well as other
modern terminals such as [Konsole] or the terminal in [vscode] allow to
Expand All @@ -326,21 +326,34 @@ can't be auto-detected, you can explicitly choose the pixelation option
in question with command line flag or environment variable (see `timg --help`).
(Please file an issue with `timg` if auto-detect does not work).

Note, for the terminal in [vscode] to display images in high-resolution, you
#### VSCode Terminal
The terminal in [vscode] to display images in high-resolution, you
need to enable the _Terminal > Integrated: Enable Images_ setting in vscode.
Otherwise you have to explicitly choose `-pq` to show the 'block' images.

#### In tmux
The terminal multiplexer `tmux` prevents high-resolution images as it filters
out the escape codes.
However, with some ... workarounds, `timg` can show such pictures
in `tmux` >= version 3.3 iff in a [kitty]-terminal.

So if you need hi-res pictures in tmux, use a kitty terminal; you
also have to explicitly set the pixelation to `-pk` (see `timg --help` for
details).

#### Sixel
Other terminals support an older high-resolution [sixel]-protocol, which you
can choose with `-ps`. Note, for this to work in xterm, you need to invoke it
with `xterm -ti vt340`.

Note, if watching videos remotely with this is too slow (due to high bandwidth
#### High resolution and low bandwidth
If watching hi-res videos remotely 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 `timg --help`, environment variable
section).
section). You can also attempt to set the `--compress` level higher.

#### Half block and quarter block rendering
### Half block and quarter block rendering

Terminals that do not support high-resolution image output can still show
images by virtue of showing colored blocks.
Expand Down Expand Up @@ -439,6 +452,7 @@ Terminal font too narrow | Correct. Here with `TIMG_FONT_WIDTH_CORRECT=1.375`
![](img/aspect-wrong.png) | ![](img/aspect-right.png)|


## Installation
### Install pre-built package

<a href="https://repology.org/project/timg/versions">
Expand Down Expand Up @@ -470,18 +484,15 @@ If you have enabled support for snap packages in your Linux distribution, you ca
sudo snap install timg
```

### Build and Install from source

#### Get dependencies on fedora
#### Use AppImage

```bash
sudo dnf install cmake git g++ pkg-config
sudo dnf install GraphicsMagick-c++-devel turbojpeg-devel libexif-devel libswscale-free-devel
The [timg release page](https://github.com/hzeller/timg/releases/latest) also
has a minimal binary in the [AppImage package format][AppImage].
To keep the size small, it does not include video decoding or some more
fancy image formats. It is good for many contexts, but for a full-featured
binary, use one from your distribution or build from source.

# If you want to include video decoding, also install these additional libraries
sudo dnf install libavcodec-free-devel libavformat-free-devel libavdevice-free-devel openslide-devel
sudo dnf install pandoc # If you want to recreate the man page
```
### Build and Install from source

#### Get dependencies on Debian/Ubuntu

Expand Down Expand Up @@ -511,6 +522,17 @@ a nix shell
nix-shell
```

#### Get dependencies on fedora

```bash
sudo dnf install cmake git g++ pkg-config
sudo dnf install GraphicsMagick-c++-devel turbojpeg-devel libexif-devel libswscale-free-devel

# If you want to include video decoding, also install these additional libraries
sudo dnf install libavcodec-free-devel libavformat-free-devel libavdevice-free-devel openslide-devel
sudo dnf install pandoc # If you want to recreate the man page
```

#### Get dependencies on macOS

```bash
Expand Down Expand Up @@ -581,3 +603,4 @@ sudo make install
[sixel]: https://en.wikipedia.org/wiki/Sixel
[QOI]: https://qoiformat.org/
[vscode]: https://code.visualstudio.com/
[AppImage]: https://appimage.org/
1 change: 1 addition & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pkgs.mkShell {
[
stdenv
cmake
git # for TIMG_VERSION_FROM_GIT
pkg-config
graphicsmagick
libjpeg
Expand Down
3 changes: 2 additions & 1 deletion src/image-source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ ImageSource *ImageSource::Create(const std::string &filename,
#ifndef WITH_TIMG_VIDEO
if (error->empty()) {
const char *const end_filename = filename.data() + filename.length();
for (const char *suffix : {".mov", ".mp4", ".mkv", ".avi", ".wmv"}) {
for (const char *suffix :
{".mov", ".mp4", ".mkv", ".avi", ".wmv", ".webm"}) {
const size_t suffix_len = strlen(suffix);
if (filename.length() < suffix_len) continue;
if (strcasecmp(end_filename - suffix_len, suffix) == 0) {
Expand Down
5 changes: 5 additions & 0 deletions src/timg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,11 @@ int main(int argc, char *argv[]) {
}
}
#endif
if (present.pixelation == Pixelation::kKittyGraphics) {
if (present.tmux_workaround) {
fprintf(stderr, " (with tmux workaround)");
}
}
fprintf(stderr, ".\n");
const rgba_t bg = display_opts.bgcolor_getter();
fprintf(stderr, "Background color for transparency '%s'",
Expand Down

0 comments on commit 2c725d9

Please sign in to comment.