viuwa

Crates.ioviuwa
lib.rsviuwa
version0.0.50
sourcesrc
created_at2022-10-09 23:14:29.619845
updated_at2022-11-11 04:08:54.496375
descriptionYet another "super simple" cli/tui ANSI image viewer, minimally compatibile with wasm32-wasi.
homepage
repositoryhttps://github.com/WanderLanz/Viuwa
max_upload_size
id684238
size333,573
Lance Warden (WanderLanz)

documentation

README

Viuwa

crate github license

Viuwa is a simple terminal ANSI image viewer trying to maintain bare-minimum compatibility with the wasm32-wasi target.

It uses almost exclusively ANSI escape codes to display images in the terminal.

Kitty, Sixel, and Iterm2 protocols are not supported, There are better tools such as viu or timg for cross-protocol terminal image viewing, please go and give them love.

Pull requests implementing different protocols are allowed as long as they don't break wasm32-wasi+ANSI compatibility.

Installation

cargo install viuwa

or for latest version

git clone https://github.com/WanderLanz/Viuwa.git && cd Viuwa && cargo install --path .

wasm file is also available in the releases section (with rayon feature disabled).

Features

  • rayon: Enables both parallel image resizing and conversions to ANSI. This is enabled by default.

Usage

Windowed image viewing (e.g. Vim)

viuwa [image]

Directly to command line (e.g. Catimg)

viuwa [image] --inline

For more advanced usage, see the help

viuwa --help

Examples

inlined w/ nearest filter

cli-f1

tui w/ triangle filter

tui-f2

tui help

tui-help

Configuration

Environment variables

  • VIUWA_QUIET: If set to true, viuwa will not print any messages or warnings.
  • VIUWA_FILTER: Set the filter type to use when resizing the image. Possible values are Nearest, Triangle, CatmullRom, Gaussian, Lanczos3. Defaults to Nearest.
  • VIUWA_COLOR: Set the color type of the output ansi image. Possible values are Truecolor, 256, Gray, and 256Gray. Defaults to Truecolor.
  • VIUWA_CORRECT: Set the luma correction level for 256 color mode, allows more pixels to be converted to grayscale for better contrast. 0-100, Defaults to 100.

With inline flag:

  • VIUWA_INLINE: If set to true, viuwa will inline the resulting ANSI image instead of using a tui.
  • VIUWA_WIDTH: Set width of inlined ANSI image, else does nothing.
  • VIUWA_HEIGHT: Set height of inlined ANSI image, else does nothing.

Known Issues

  • On wasm, ANSI raw mode sequences are commonly ignored, so you may need to press enter to send input to the program.
  • Some wasm runtimes may kill the program waiting for user input. May cause terminal to be left in a weird state.

License

This project is licensed under MIT or Apache-2.0.

Contributing

See CONTRIBUTING.md.

Dependencies

  • clap crate
  • image crate
  • rayon crate
  • ndarray crate
  • crossterm crate
Commit count: 54

cargo fmt