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 View Images in Linux Terminal

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article shows you how Linux terminals view images. The content is concise and easy to understand. It can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Linux has many GUI applications for viewing images. But I've never tried to use any command line to view it.

In addition, I've got another good tool for this purpose, called FIM.

Fortunately, when using the ImageMagick tool, I got a command to view the image from the terminal. The command name is "display, which is part of the ImageMagick tool. This is a good tool that allows UNIX-like users to view images from the terminal.

We will show you how to install and use it to view images from a Linux terminal. These commands use the system's frame buffer framebuffer to display images directly from the command line.

How to use the display command to view an image from a terminal

ImageMagick is a free and open source, feature-rich, command-line-based image processing tool. It is used to create, edit, compose, or convert bitmap images. It can read and write images in various formats, including PNG, JPEG, GIF, PDF, SVG and so on. It can adjust the size of the image, mirror, rotate, convert the image, adjust the color of the image, apply a variety of special effects and so on. It supports batch processing, allowing you to process all images at once.

How do I install ImageMagick?

The ImageMagick package is included in the official repository of most Linux distributions. Use the distribution package manager to install it.

* * it is important to note that * * make sure that the "Development Tools" package has been installed on your Linux system, which is a prerequisite for installation.

For the RHEL/CentOS 6apace 7 system, use the yum command to install ImageMagick:

$sudo yum install-y ImageMagick ImageMagick-devel

On RHEL/CentOS 8 and Fedora systems, use the dnf command to install ImageMagick:

$sudo dnf install-y ImageMagick ImageMagick-devel

For Debian/Ubuntu systems, use the apt command or the apt-get command to install ImageMagick:

$sudo apt-get update$ sudo apt-get install imagemagick

For openSUSE systems, use the zypper command to install ImageMagick:

$sudo zypper install-y ImageMagick

To view any image files, run the display command, as shown below. You can press the Esc/q button to close the image:

$display bird.jpg

If you want to open the image with the specified window size, use the-geometry flag:

$display-geometry 1000x600 ~ / Downloads/bird.jpg

You can also enter the location information of the image through the display command. The following command opens the image from 800 pixels from the top of the desktop and 800 pixels from the upper left corner:

$display-geometry 1000x600+800+800 ~ / Downloads/bird.jpg

If you want to resize the image with the display command, use the following format:

$display-resize 600x400 ~ / Downloads/bird.jp

In addition, you can also use a percentage to resize the picture:

$display-resize 50% ~ / Downloads/bird.jpg

How to use the fim command to view an image from a terminal

FIM is a lightweight global image viewer designed specifically for Linux. But it is not limited to Linux, it can also be configured to run on other operating systems, such as MS-Windows.

For users familiar with software such as VIM text editors, it is a highly customizable and scriptable image viewer. It can display images on full screen and can be easily controlled using keyboard shortcuts. It is a very lightweight tool because it relies only on certain libraries.

It can open many file formats and display images in the following video modes:

Use Linux frame buffering devices to graphically.

Under X/Xorg, use the SDL library to graphically

Under X/Xorg, use the Imlib2 library to graphically.

Use the AAlib library to render in ASCII art form in any text console.

The runtime automatically detects or selects the correct video mode, and if necessary, you can choose to add or remove it when configuring before building.

FIM is an acronym for "Fbi IMproved" and a replica of Fbi Image Viewer.

FIM can be easily installed on Debian/Ubuntu-based systems because the package is available in the official repository of the distribution. For other distributions, you may need to compile it from source:

$sudo apt install fim

After installation, you can use the following command to display the image:

$fim bird.jpg

You can use the-an option to automatically zoom the image:

$fim-a bird.jpg

If you want to open multiple image files in the current directory, use wildcards to open them all. Use the PageUp/PageDown keyboard shortcut to move to the next or previous image:

$fim-a * .jpg

To view the image in ASCII format, you can use the-t flag:

$fim-t bird.jpg

The following keyboard shortcuts allow you to control the image:

PageUp/PageDown: previous / next picture.

+ / -: zoom in / out

A: auto Zoom

W: fit width

ESC/q: exit

The above is how Linux terminals view images. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are 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

Development

Wechat

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

12
Report