Linux 如何通过命令行查看图片 All In One
Linux 如何通过命令行查看图片 All In One
Terminal
solutions
- ImageMagick
- FIM
- Viu
- LsiX
- xdg-open
ImageMagick
ImageMagick®
is a free, open-source software suite, used forediting
andmanipulating
digital images.
It can be used tocreate
,edit
,compose
, or convertbitmap
images, and supports a wide range offile formats
, includingJPEG
,PNG
,GIF
,TIFF
, and
ImageMagick includes a command-line
interface for executing complex image processing tasks, as well as APIs
for integrating its features into software applications.
It is written in C
and can be used on a variety of operating systems
, including Linux
, Windows
, and macOS
.
https://github.com/ImageMagick/ImageMagick
# 对于 Debian/Ubuntu 系统,使用 apt 命令 或 apt-get 命令安装 ImageMagick
# Raspberry Pi (基于 Debian 系统)
$ sudo apt-get update
$ sudo apt-get install imagemagick
# 要查看任何图像文件,请运行 display 命令
# 按下 Esc/q 按钮关闭图像
$ display logo.jpg
# 指定的窗口大小打开图像,请使用 -geometry 标志
$ display -geometry 1000x600 ~/Doesktop/logo.jpg
# 通过输入打开图像的位置信息
# 下面的命令可以从桌面的距顶部 800 像素和据左上角 800 像素处打开图像:
$ display -geometry 1000x600+800+800 ~/Downloads/logo.jpg
# 想调整图像的大小,请使用 -resize 标志
$ display -resize 600x400 ~/Downloads/logo.jpg
# 使用百分比来调整图片的大小
$ display -resize 50% ~/Downloads/logo.jpg
Linux 发行版
Raspberry Pi O
S(原为 Raspbian
)是为树莓派基于 Debian
开发的操作系统。
https://zh.wikipedia.org/wiki/Raspberry_Pi_OS
FIM
FIM 是一个专门为 Linux 设计的轻量级全局图像查看器
FIM is a lightweight universal image viewer, conceived when working in Linux.
FIM aims to be a highly customizable and scriptable image viewer for users who are comfortable with software like the VIM text editor (see this minitutorial) or the Mutt mail user agent (see this minitutorial).
It has been developed with Linux in mind, but can be built to run on several Unix systems or even on MS-Windows.
FIM 是一个轻量级的通用图像查看器,在 Linux 中工作时构思出来的。
FIM 的目标是为熟悉 VIM 文本编辑器(参见本迷你教程)或 Mutt 邮件用户代理(参见本迷你教程)等软件的用户提供高度可定制和可编写脚本的图像查看器。
它是为 Linux 开发的,但可以构建为在多个 Unix 系统甚至 MS-Windows 上运行。
https://www.nongnu.org/fbi-improved/#docs
# 安装
# $ sudo apt install fim
$ sudo apt-get install fim
# 显示图像
$ fim logo.jpg
# 使用 -a 选项自动缩放图像
$ fim -a logo.jpg
# 要打开当前目录中的多个图像文件,请使用通配符将它们全部打开
# 使用 PageUp/PageDown 键盘快捷键移动到下一张或上一张图像
$ fim -a *.jpg
# 要以 ASCII 格式查看图像,可以使用 -t 标志
$ fim -t logo.jpg
下面的键盘快捷键
可以让你控制图像
:
PageUp/PageDown:上一张/下一张图片
+/-:放大/缩小
a:自动缩放
w:适应宽度
ESC/q:退出
Viu
$ brew install viu
$ viu logo.gif
View images right from the terminal.
Usage: viu [OPTIONS] [file]...
Arguments:
[file]... The images to be displayed. Set to - for standard input.
Options:
-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
-H, --help
Print help information
-V, --version
Print version information
https://github.com/atanunq/viu
Lsix
# 考虑到 lsix 使用ImageMagick,我们必须确保已在系统上安装了它
$ lsix
$ lsix *jpg *png
$ lsix *.pdf
https://github.com/hackerb9/lsix
Requirements: just ImageMagick
(and a Sixel
terminal, of course)
https://github.com/hackerb9/lsix/blob/master/lsix#L6
xdg-open
# 自带的, 怎么不好使呀
pi@raspberrypi:~/Desktop $ xdg-open ./2020-08-15-235755_1824x984_scrot.png
Error: no "view" rule for type "image/png" passed its test case
(for more information, add "--debug=1" on the command line)
/usr/bin/xdg-open: 870: /usr/bin/xdg-open: www-browser: not found
/usr/bin/xdg-open: 870: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 870: /usr/bin/xdg-open: elinks: not found
/usr/bin/xdg-open: 870: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 870: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 870: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening './2020-08-15-235755_1824x984_scrot.png'
pi@raspberrypi:~/Desktop $ xdg-open ./2020-08-15-235755_1824x984_scrot.png --debug=1
xdg-open: unexpected option '--debug=1'
Try 'xdg-open --help' for more information.
pi@raspberrypi:~/Desktop $
Linux 发行版 All In One
https://zh.wikipedia.org/wiki/Linux发行版
https://zh.wikipedia.org/wiki/Linux发行版列表
Linux Distribution Timeline / Linux 发行版时间线
Linux Distribution Timeline / Linux 发行版时间线
(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!
refs
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/17268733.html
未经授权禁止转载,违者必究!