Linux There are many ways to view images GUI application . But I've never tried to see it with any command-line app .
Fortunately, , In the use of ImageMagick Tools when , I got a command to view the image from the terminal . The command name is
“display, It is ImageMagick Part of the tool . This is a good tool , Allow classes UNIX Users view images from the terminal .
Besides , I also got another great tool for this purpose , be called FIM.
We'll show you how to install and use it from Linux Terminal view image . These commands use the system's frame buffer framebuffer Display images directly from the command line .
How to use display View the image from the terminal command
ImageMagick It's a free and open source 、 Rich in functions 、 Command line based image processing tool . It is used to create 、 edit 、 Compose or convert bitmap images . It can read and write to various formats （ exceed 200 Kind of ） Image , Include PNG、JPEG、GIF、PDF、SVG etc. . It can adjust the size of the image 、 Mirror image 、 rotate 、 Converting images 、 Adjust the image color 、 Apply various special effects, etc . It supports batch processing , Allows you to process all images at once .
How to install ImageMagick？
ImageMagick Software packages are included in most Linux In the official warehouse of the distribution . Use the distribution package manager to install it .
** It should be noted that ：** Make sure your Linux The system already has “Development Tools” package , This is a prerequisite for installation .
about RHEL/CentOS 6/7 System , Please use yum command install ImageMagick：
sudo yum install -y ImageMagick ImageMagick-devel
stay RHEL/CentOS 8 and Fedora System , Use dnf command install ImageMagick：
sudo dnf install -y ImageMagick ImageMagick-devel
$ sudo apt-get update $ sudo apt-get install imagemagick
about openSUSE System , Use zypper command install ImageMagick：
sudo zypper install -y ImageMagick
To view any image file , Please run
display command , As shown below . You can press
q Button to close the image ：
$ display bird.jpg
If you want to open an image with a specified window size , Please use
-geometry sign ：
$ display -geometry 1000x600 ~/Downloads/bird.jpg
You can also pass
display Command input image location information . The following commands can be viewed from the top of the desktop 800 Pixels and according to the upper left corner 800 Open the image at pixels ：
$ display -geometry 1000x600+800+800 ~/Downloads/bird.jpg
If you want to use
display Command to adjust the size of the image , Please use the following format ：
$ display -resize 600x400 ~/Downloads/bird.jp
in addition , You can also use percentages to adjust the size of the picture ：
$ display -resize 50% ~/Downloads/bird.jpg
How to use fim View the image from the terminal command
FIM It's a special one for Linux Design of lightweight global image viewer . But it's not limited to Linux, It can also be configured to run on other operating systems , Such as MS-Windows.
For those familiar with VIM Text editor and other software users , It's a highly customizable and scriptable image viewer . It can display images in full screen , It's easy to use keyboard shortcuts . It's a very lightweight tool , Because it only depends on certain Libraries .
It can open many file formats , It can display images in the following video modes ：
- Use Linux Frame buffer device graphics .
- stay X/Xorg Next , Use SDL Library graphics
- stay X/Xorg Next , Use Imlib2 Library graphics .
- Use AAlib library , In any text console with ASCII Art forms present .
Automatically detect or select the correct video mode at runtime , if necessary , You can choose to add or remove from the pre build configuration .
FIM yes “Fbi IMproved” Abbreviation , yes Fbi Image Viewer A reprint of .
FIM Can be easily installed based on Debian/Ubuntu On the system , Because the package is available in the official repository of the distribution . For other distributions , You may need to compile it from the source code ：
sudo apt install fim
After installation , You can use the following command to display the image ：
You can use
-a Option auto zoom image ：
fim -a bird.jpg
If you want to open multiple image files in the current directory , Please use wildcards to open them all . Use
PageDown Keyboard shortcut to move to the next or previous image ：
fim -a *.jpg
To use ASCII Format view image , have access to
-t sign ：
fim -t bird.jpg
The following keyboard shortcuts let you control the image ：
PageDown： Previous / Next picture .
-： Zoom in / narrow
a： Automatic scaling
w： Fit width
q： sign out