diff --git a/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md b/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md deleted file mode 100644 index 871b9b29cc..0000000000 --- a/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md +++ /dev/null @@ -1,186 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Display Thumbnail Images In Terminal) -[#]: via: (https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To Display Thumbnail Images In Terminal -====== -![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-720x340.png) - -A while ago, we discussed about [**Fim**][1], a lightweight, CLI image viewer application used to display various type of images, such as bmp, gif, jpeg, and png etc., from command line. Today, I stumbled upon a similar utility named **‘lsix’**. It is like ‘ls’ command in Unix-like systems, but for images only. The lsix is a simple CLI utility designed to display thumbnail images in Terminal using **Sixel** graphics. For those wondering, Sixel, short for six pixels, is a type of bitmap graphics format. It uses **ImageMagick** , so almost all file formats supported by imagemagick will work fine. - -### Features - -Concerning the features of lsix, we can list the following: - - * Automatically detects if your Terminal supports Sixel graphics or not. If your Terminal doesn’t support Sixel, it will notify you to enable it. - * Automatically detects the terminal background color. It uses terminal escape sequences to try to figure out the foreground and background colors of your Terminal application and will display the thumbnails clearly. - * If there are more images in the directory, usually >21, lsix will display those images one row a a time, so you need not to wait for the entire montage to be created. - * Works well over SSH, so you can manipulate images stored on your remote web server without much hassle. - * It supports Non-bitmap graphics, such as.svg, .eps, .pdf, .xcf etc. - * Written in BASH, so works on almost all Linux distros. - - - -### Installing lsix - -Since lsix uses ImageMagick, make sure you have installed it. It is available in the default repositories of most Linux distributions. For example, on Arch Linux and its variants like Antergos, Manjaro Linux, ImageMagick can be installed using command: - -``` -$ sudo pacman -S imagemagick -``` - -On Debian, Ubuntu, Linux Mint: - -``` -$ sudo apt-get install imagemagick -``` - -lsix doesn’t require any installation as it is just a BASH script. Just download it and move it to your $PATH. It’s that simple. - -Download the latest lsix version from project’s github page. I am going to download the lsix archive file using command: - -``` -$ wget https://github.com/hackerb9/lsix/archive/master.zip -``` - -Extract the downloaded zip file: - -``` -$ unzip master.zip -``` - -This command will extract all contents into a folder named ‘lsix-master’. Copy the lsix binary from this directory to your $PATH, for example /usr/local/bin/. - -``` -$ sudo cp lsix-master/lsix /usr/local/bin/ -``` - -Finally, make the lsbix binary executable: - -``` -$ sudo chmod +x /usr/local/bin/lsix -``` - -That’s it. Now is the time to display thumbnails in the terminal itself. - -Before start using lsix, **make sure your Terminal supports Sixel graphics**. - -The developer has developed lsix on an Xterm in **vt340 emulation mode**. However, the he claims that lsix should work on any Sixel compatible Terminal. - -Xterm supports Sixel graphics, but it isn’t enabled by default. - -You can launch Xterm with Sixel mode enabled using command (from another Terminal): - -``` -$ xterm -ti vt340 -``` - -Alternatively, you can make vt340 the default terminal type for Xterm as described below. - -Edit **.Xresources** file (If it not available, just create it): - -``` -$ vi .Xresources -``` - -Add the following line: - -``` -xterm*decTerminalID : vt340 -``` - -Press **ESC** and type **:wq** to save and close the file. - -Finally, run the following command to apply the changes: - -``` -$ xrdb -merge .Xresources -``` - -Now Xterm will start with Sixel mode enabled at every launch by default. - -### Display Thumbnail Images In Terminal - -Launch Xterm (Don’t forget to start it with vt340 mode). Here is how Xterm looks like in my system. -![](https://www.ostechnix.com/wp-content/uploads/2019/01/xterm-1.png) - -Like I already stated, lsix is very simple utility. It doesn’t have any command line flags or configuration files. All you have to do is just pass the path of your file as an argument like below. - -``` -$ lsix ostechnix/logo.png -``` - -![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-4.png) - -If you run it without path, it will display the thumbnail images in your current working directory. I have few files in a directory named **ostechnix**. - -To display the thumbnails in this directory, just run: - -``` -$ lsix -``` - -![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-1.png) - -See? The thumbnails of all files are displayed in the terminal itself. - -If you use ‘ls’ command, you would just see the filenames only, not thumbnails. - -![][3] - -You can also display a specific image or group of images of a specific type using wildcards. - -For example, to display a single image, just mention the full path of the image like below. - -``` -$ lsix girl.jpg -``` - -![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-2.png) - -To display all images of a specific type, say PNG, use the wildcard character like below. - -``` -$ lsix *.png -``` - -![][4] - -For JPEG type images, the command would be: - -``` -$ lsix *jpg -``` - -The thumbnail image quality is surprisingly good. I thought lsix would just display blurry thumbnails. I was wrong. The thumbnails are clearly visible just like on the graphical image viewers. - -And, that’s all for now. As you can see, lsix is very similar to ‘ls’ command, but it only for displaying thumbnails. If you deal with a lot of images at work, lsix might be quite handy. Give it a try and let us know your thoughts on this utility in the comment section below. If you know any similar tools, please suggest them as well. I will check and update this guide. - -More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/ - -作者:[SK][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/how-to-display-images-in-the-terminal/ -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/ls-command-1.png -[4]: http://www.ostechnix.com/wp-content/uploads/2019/01/lsix-3.png diff --git a/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md b/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md new file mode 100644 index 0000000000..7984083891 --- /dev/null +++ b/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Display Thumbnail Images In Terminal) +[#]: via: (https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +如何在终端显示图像缩略图 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-720x340.png) + +不久前,我们讨论了 [Fim][1],这是一个轻量级的命令行图像查看器应用程序,用于从命令行显示各种类型的图像,如 bmp、gif、jpeg 和 png 等。今天,我偶然发现了一个名为 `lsix` 的类似工具。它类似于类 Unix 系统中的 `ls` 命令,但仅适用于图像。`lsix` 是一个简单的命令行实用程序,旨在使用 Sixel 图形在终端中显示缩略图。对于那些想知道的人来说,Sixel 是六像素的缩写,是一种位图图形格式。它使用 ImageMagick,因此几乎所有 imagemagick 支持的文件格式都可以正常工作。 + +### 功能 + +关于 `lsix` 的功能,我们可以列出如下: + +* 自动检测你的终端是否支持 Sixel 图形。如果你的终端不支持 Sixel,它会通知你启用它。 +* 自动检测终端背景颜色。它使用终端转义序列来试图找出终端应用程序的前景色和背景色,并清楚地显示缩略图。 +* 如果目录中有更多图像,通常大于 21 个,`lsix` 将一次显示这些图像,因此你无需等待创建整个蒙太奇图像。 +* 可以通过 SSH 工作,因此你可以轻松操作存储在远程 Web 服务器上的图像。 +* 它支持非位图图形,例如 .svg、.eps、.pdf、.xcf 等。 +* 用 Bash 编写,适用于几乎所有 Linux 发行版。 +   +### 安装 lsix + +由于 `lsix` 使用 ImageMagick,请确保已安装它。它在大多数 Linux 发行版的默认软件库中都可用。 例如,在 Arch Linux 及其变体如 Antergos、Manjaro Linux 上,可以使用以下命令安装ImageMagick: + +``` +$ sudo pacman -S imagemagick +``` + +在 Debian、Ubuntu、Linux Mint: + +``` +$ sudo apt-get install imagemagick +``` + +`lsix` 并不需要安装,因为它只是一个 Bash 脚本。只需要下载它并移动到你的 `$PATH` 中。就这么简单。 + +从该项目的 GitHub 主页下载最新的 `lsix` 版本。我使用如下命令下载 `lsix` 归档包: + +``` +$ wget https://github.com/hackerb9/lsix/archive/master.zip +``` + +提取下载的 zip 文件: + +``` +$ unzip master.zip +``` + +此命令将所有内容提取到名为 `lsix-master` 的文件夹中。将 `lsix` 二进制文件从此目录复制到 `$ PATH` ,例如 `/usr/local/bin/`。 + +``` +$ sudo cp lsix-master/lsix /usr/local/bin/ +``` + +最后,使 `lsbix` 二进制文件可执行: + +``` +$ sudo chmod +x /usr/local/bin/lsix +``` + +如此,现在是在终端本身显示缩略图的时候了。 + +在开始使用 `lsix` 之前,请确保你的终端支持 Sixel 图形。 + +开发人员在 vt340 仿真模式下的 Xterm 上开发了 `lsix`。 然而,他声称 `lsix` 应该适用于任何Sixel 兼容终端。 + +Xterm 支持 Sixel 图形,但默认情况下不启用。 + +你可以从另外一个终端使用命令启动有个启用了 Sixel 模式的 Xterm: + +``` +$ xterm -ti vt340 +``` + +或者,你可以使 vt340 成为 Xterm 的默认终端类型,如下所述。 + +编辑 `.Xresources` 文件(如果它不可用,只需创建它): + +``` +$ vi .Xresources +``` + +添加如下行: + +``` +xterm*decTerminalID : vt340 +``` + +按下 `ESC` 并键入 `:wq` 以保存并关闭该文件。 + +最后,运行如下命令来应用改变: + +``` +$ xrdb -merge .Xresources +``` + +现在,每次启动 Xterm 就会默认启用 Sixel 模式。 + +### 在终端中显示缩略图 + +启动 Xterm(不要忘记以 vt340 模式启动它)。以下是 Xterm 在我的系统中的样子。 + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/xterm-1.png) + +就像我已经说过的那样,`lsix` 非常简单实用。它没有任何命令行选项或配置文件。你所要做的就是将文件的路径作为参数传递,如下所示。 +Like I already stated, lsix is very simple utility. It doesn’t have any command + +``` +$ lsix ostechnix/logo.png +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-4.png) + +如果在没有路径的情况下运行它,它将显示在当前工作目录中的缩略图图像。我在名为 `ostechnix` 的目录中有几个文件。 + +要显示此目录中的缩略图,只需运行: + +``` +$ lsix +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-1.png) + +看到了吗?所有文件的缩略图都显示在终端里。 + +如果使用 `ls` 命令,则只能看到文件名,而不是缩略图。 + +![][3] + +你还可以使用通配符显示特定类型的指定图像或一组图像。 + +例如,要显示单个图像,只需提及图像的完整路径,如下所示。 + +``` +$ lsix girl.jpg +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-2.png) + +要显示特定类型的所有图像,例如 PNG,请使用如下所示的通配符。 + +``` +$ lsix *.png +``` + +![][4] + +对于 JEPG 类型,命令如下: + +``` +$ lsix *jpg +``` + +缩略图的显示质量非常好。我以为 `lsix` 会显示模糊的缩略图。但我错了,缩略图清晰可见,就像在图形图像查看器上一样。 + +而且,这一切都是唾手可得。如你所见,`lsix` 与 `ls` 命令非常相似,但它仅用于显示缩略图。如果你在工作中处理很多图像,`lsix` 可能会非常方便。试一试,请在下面的评论部分告诉我们你对此实用程序的看法。如果你知道任何类似的工具,也请提出建议。我将检查并更新本指南。 + +更多好东西即将到来。敬请关注! + +干杯! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/how-to-display-images-in-the-terminal/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/ls-command-1.png +[4]: http://www.ostechnix.com/wp-content/uploads/2019/01/lsix-3.png