Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to display image thumbnails in linux terminal

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to display image thumbnails in the terminal in linux", the content is simple and clear, hoping to help you solve your doubts, the following let the editor lead you to study and learn "how to display image thumbnails in the terminal in linux" this article.

Fim this is a lightweight command-line image viewer application for displaying various types of images from the command line, such as bmp, gif, jpeg, png, and so on. Today, I stumbled upon a similar tool called lsix. It is similar to the ls command in Unix-like systems, but only for images. Lsix is a simple command-line utility designed to display thumbnails in a terminal using the Sixel graphics format. For those who want to know, Sixel is an abbreviation for six-pixel pixels, a bitmap graphics format. It uses ImageMagick, so almost all the file formats supported by imagemagick work properly.

Function

We can list the functions of lsix as follows:

Automatically detect whether your terminal supports Sixel graphics format. If your terminal does not support Sixel, it will notify you to enable it.

Automatically detect the terminal background color. It uses terminal escape sequences to try to find out the foreground and background colors of terminal applications and clearly display thumbnails.

If there are more images in the directory (usually more than 21), lsix will display them all at once, so you don't have to wait for the entire montage image to be created.

You can work through SSH, so you can easily manipulate images stored on remote Web servers.

It supports non-bitmap graphics, such as .svg, .eps, .pdf, .xcf, etc.

Written in Bash, suitable for almost all Linux distributions.

Install lsix

Because lsix uses ImageMagick, make sure it is installed. It is available in the default libraries of most Linux distributions. For example, on Arch Linux and its variants such as Antergos, Manjaro Linux, you can install ImageMagick using the following command:

$sudo pacman-S imagemagick

In Debian, Ubuntu, Linux Mint:

$sudo apt-get install imagemagick

Lsix does not need to be installed because it is just a Bash script. Just download it and move it to your $PATH. It's that simple.

Download the lsix version of * * from the GitHub home page of the project. I download the lsix archive package using the following command:

$wget https://github.com/hackerb9/lsix/archive/master.zip

Extract the downloaded zip file:

$unzip master.zip

This command extracts everything into a folder named lsix-master. Copy the lsix binaries from this directory into $PATH, for example, / usr/local/bin/.

$sudo cp lsix-master/lsix / usr/local/bin/

* to make lsix binaries executable:

$sudo chmod + x / usr/local/bin/lsix

Thus, it is time to display thumbnails in the terminal itself.

Before you start using lsix, make sure your terminal supports Sixel graphics format.

The developer developed lsix on Xterm in vt340 simulation mode. However, he claims that lsix should apply to any Sixel-compatible terminal.

Xterm supports the Sixel drawing format, but it is not enabled by default.

You can use the command from another terminal to start a Xterm with Sixel mode enabled:

$xterm-ti vt340

Alternatively, you can make vt340 the default terminal type for Xterm, as described below.

Edit the .Xresources file (if it is 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.

* run the following command to apply the changes:

$xrdb-merge .Xresources

Now, Sixel graphics support is enabled by default every time you start Xterm.

Display thumbnails in the terminal

Start Xterm (don't forget to start it in vt340 mode). Here's what Xterm looks like in my system.

As I have already said, lsix is very simple and practical. It does not have any command line options or configuration files. All you have to do is pass the path to the file as an argument, as shown below.

$lsix ostechnix/logo.png

If you run it without a path, it displays the thumbnail image in the current working directory. I have several files in a directory called ostechnix.

To display the thumbnails in this directory, simply run:

$lsix

You see that? Thumbnails of all files are displayed in the terminal.

If you use the ls command, you can only see the file name, not the thumbnail.

You can also use wildcards to display specific types of specified images or a set of images.

For example, to display a single image, simply mention the full path to the image, as shown below.

$lsix girl.jpg

To display all images of a particular type, such as PNG, use the wildcards shown below.

$lsix * .png

For the JEPG type, the command is as follows:

$lsix * jpg

The display quality of thumbnails is very good. I thought lsix would show blurry thumbnails. But I was wrong, and the thumbnails are clearly visible, just like in a graphic image viewer.

Moreover, all of this is readily available. As you can see, lsix is very similar to the ls command, but it is only used to display thumbnails. If you work with a lot of images, lsix may be very convenient. Give it a try. Please tell us what you think of this utility in the comments section below. If you know of any similar tools, please also make suggestions.

The above is all the contents of the article "how to display image thumbnails in the terminal in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report