• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/workflows/H18-Sep-2020-2522

cargo-crates/H03-May-2022-689,298555,387

img/H03-May-2022-

src/H18-Sep-2020-831691

.gitignoreH A D18-Sep-2020377 1712

Cargo.lockH A D18-Sep-202018.3 KiB753673

Cargo.tomlH A D18-Sep-2020803 2723

LICENSE-MITH A D18-Sep-20201 KiB2217

README.mdH A D18-Sep-20203.6 KiB13795

wapm.tomlH A D18-Sep-2020322 1613

README.md

1# viu
2
3### Description
4A small command-line application to view images from the terminal written in Rust. It uses lower
5half blocks (▄ or \u2584) to fit 2 pixels into a single cell by adjusting foreground and background
6colours accordingly.
7
8When run, `viu` will check the value of `$COLORTERM`. If it contains either `truecolor` or `24bit`,
9truecolor (16 million colors) will be used. If not, it will fallback to using only ansi256. A nice
10explanation can be found in this [gist](https://gist.github.com/XVilka/8346728).
11
12
13Features (see [Usage](#usage)):
14- Animated GIF support
15- Accept media through stdin
16- Custom dimensions
17- Transparency
18
19### Installation
20
21#### From source (recommended)
22
23##### Standard
24Installation from source requires a local [Rust
25environment](https://www.rust-lang.org/tools/install). Please note that at least Rust 1.39 is required.
26
27```bash
28git clone https://github.com/atanunq/viu.git
29
30# Build & Install
31cd viu/
32cargo install --path .
33
34# Use
35viu img/giphy.gif
36```
37Or without cloning:
38```bash
39cargo install viu
40```
41
42##### [WASI](https://github.com/wasmerio/wasmer)
43First, you will need the WASI target installed in your Rust system:
44
45```bash
46rustup target add wasm32-wasi --toolchain nightly
47```
48
49Once WASI is available, you can build the WebAssembly binary by yourself with:
50
51```bash
52cargo +nightly build --release --target wasm32-wasi
53```
54
55This will create a new file located at `target/wasm32-wasi/release/viu.wasm`.
56
57When the wasm file is created you can upload it to wapm or execute it with wasmer:
58
59```bash
60wapm publish
61# OR
62wasmer run  target/wasm32-wasi/release/viu.wasm --dir=. -- img/giphy.gif
63```
64
65#### Binary
66A precompiled binary can be downloaded from the [release
67page](https://www.github.com/atanunq/viu/releases/latest).
68
69#### From wapm
70
71Viu can be installed in Linux, macOS and Windows using [wapm](https://wapm.io/):
72
73```bash
74wapm install -g viu
75```
76
77#### Packages
78
79##### Arch Linux
80There is an [AUR package available for Arch Linux](https://aur.archlinux.org/packages/viu/).
81
82### Usage
83![Demo](img/demo.gif)
84
85
86![Demo](img/gifdemo.gif)
87
88
89![Demo](img/curldemo.gif)
90
91
92Ctrl-C was pressed to stop the GIFs.
93
94
95Examples:
96
97- `viu img/giphy.gif`
98- `viu img/*`
99- `viu ~/Pictures -rn`
100
101
102The shell will expand the wildcard above and `viu` will display all the images in the folder one
103after the other. For a more informative output when dealing with folders the flag **-n** could be
104used.
105
106When `viu` receives only one file and it is GIF, it will be displayed over and over until Ctrl-C is
107pressed. However, when couple of files are up for display (second example) the GIF will be displayed
108only once.
109
110##### Aspect Ratio
111If no flags are supplied to `viu` it will try to get the size of the terminal where it was invoked.
112If it succeeds it will fit the image and preserve the aspect ratio. The aspect ratio will be changed
113only if both options **-w** and **-h** are used together.
114
115##### Command line options
116```
117USAGE:
118    viu [FLAGS] [OPTIONS] [FILE]...
119    When FILE is -, read standard input.
120
121FLAGS:
122    -m, --mirror         Display a mirror of the original image
123    -n, --name           Output the name of the file before displaying
124    -1, --once           Only loop once through the animation
125    -r, --recursive      Recurse down directories if passed one
126    -s, --static         Show only first frame of gif
127    -t, --transparent    Display transparent image with transparent background
128    -v, --verbose        Output what is going on
129
130OPTIONS:
131    -h, --height <height>    Resize the image to a provided height
132    -w, --width <width>      Resize the image to a provided width
133
134ARGS:
135    <FILE>...    The image to be displayed
136```
137