viu 一个用Rust编写命令行应用程序,用于在终端中查看图像

网友投稿 670 2022-10-31

viu 一个用Rust编写命令行应用程序,用于在终端中查看图像

viu 一个用Rust编写命令行应用程序,用于在终端中查看图像

viu

Description

A small command-line application to view images from the terminal written in Rust. It uses lower half blocks (▄ or \u2584) to fit 2 pixels into a single cell by adjusting foreground and background colours accordingly.

Features (see Usage):

Animated GIF supportAccept media through stdinCustom dimensions

Installation

From source

Installation from source requires a local Rust environment.

git clone https://github.com/atanunq/viu.git# Build & Installcd viu/cargo install --path .# Useviu img/giphy.gif

Or without cloning:

cargo install viu

Binary

A precompiled binary can be downloaded from the release page.

Packages

Arch Linux

There is an AUR package available for Arch Linux.

Usage

Ctrl-C was pressed to stop the GIFs.

Examples:

viu img/giphy.gifviu img/*

The shell will expand the wildcard above and viu will display all the images in the folder one after the other. For a more informative output when dealing with folders the flag -n could be used.

When viu receives only one file and it is GIF, it will be displayed over and over until Ctrl-C is pressed. However, when couple of files are up for display (second example) the GIF will be displayed only once.

Aspect Ratio

If no flags are supplied to viu it will try to get the size of the terminal where it was invoked. If it succeeds it will fit the image and preserve the aspect ratio. The aspect ratio will be changed only if both options -w and -h are used together.

Command line options

USAGE: viu [FLAGS] [OPTIONS] ...FLAGS: -m, --mirror Display a mirror of the original image -t, --transparent Display transparent pixels in the color of the terminal -n, --name Output the name of the file before displaying -v, --verbose Output what is going onOPTIONS: -h, --height Resize the image to a provided height -w, --width Resize the image to a provided widthARGS: ... The image to be displayed

TODOs:

Reimplement STDIN image support based on #7 Use crossterm to add Windows support and remove magic terminal escape sequences Tests

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:springboot 静态方法中使用@Autowired注入方式
下一篇:APKinspector是一个功能强大的GUI工具,供分析人员分析Android应用程序
相关文章

 发表评论

暂时没有评论,来抢沙发吧~