knowledge/technology/applications/cli/viu.md

37 lines
3.3 KiB
Markdown
Raw Normal View History

2024-03-15 08:37:41 +00:00
---
obj: application
repo: https://github.com/atanunq/viu
rev: 2024-03-15
---
# viu
A small command-line application to view images from the terminal written in [Rust](../../dev/programming/languages/Rust.md). It is basically the front-end of [`viuer`](https://github.com/atanunq/viuer). It uses either iTerm or Kitty graphics protocol, if supported. If not, lower half blocks (`▄` or `\u2584`) are displayed instead.
Based on the value of `$TERM`, `viuer` decides which protocol to use. For half blocks, `$COLORTERM` is inspected. If it contains either `truecolor` or `24bit`, truecolor (16 million colors) will be used. If not, it will fallback to using only ansi256. A nice explanation can be found in this [gist](https://gist.github.com/XVilka/8346728).
## Features
- Native iTerm and Kitty support
- Animated GIF support
- Accept media through stdin
- Custom dimensions
- Transparency
- Experimental Sixel support (behind the `sixel` feature flag)
## Options
Usage: `viu [OPTIONS] [file]...`
| Option | Description |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `-w, --width <width>` | Resize the image to a provided width |
| `-h, --height <height>` | Resize the image to a provided height |
| `-x <x>` | X offset \[default: 0] |
| `-y <y>` | Y offset \[default: 0] |
| `-a, --absolute-offset` | Make the x and y offset be relative to the top left terminal corner. If not set, they are relative to the cursor's position. |
| `-r, --recursive` | Recurse down directories if passed one |
| `-b, --blocks` | Force block output |
| `-n, --name` | Output the name of the file before displaying |
| `-t, --transparent` | Display transparent images with transparent background |
| `-f, --frame-rate <frames-per-second>` | Play the gif at a given frame rate |
| `-1, --once` | Loop only once through the gif |
| `-s, --static` | Show only the first frame of the gif |