How To View A PNG File in Linux?

A PNG (Portable Network Graphics) file is a type of image file that utilizes lossless compression, which means that it can retain the full quality of the original image while still reducing its file size. One of the key features of PNG files is that they support transparent backgrounds, which makes them well-suited for use on websites and other online platforms.

This post will enlist the possible methods to view PNG files in Linux.

View PNG File Using any Web Browser

First, open the web browser and then drag the PNG file into the browser window. You will be able to see the content as shown below:

View the PNG File Using the feh Image Viewer

Linux also provides command-line tools that can be used to view PNG files, and for that, the “feh” (Fast Light Image Viewer) is considered to be the most popular tool.

Installing feh Image Viewer on Linux

This tool isn’t pre-installed in the Linux operating system. You must install it by typing any of the following commands depending on your distros.

$ sudo apt install feh            #For Debian/Ubuntu-based
$ sudo yum install feh            #For CentOS
$ sudo dnf install feh            #For Fedora

View PNG

We have a PNG file with the name “Linux.png” so to view it, you need to type the below command in the terminal:

$ feh Linux.png

By executing the above command, the following image will be opened for us.

View the PNG File Using the eog Image Viewer

There is another image viewer available for Linux with the name eog (Eye of Gnome), which has a more polished user interface than the feh.

Installing the eog Image Viewer

To install this useful utility, run the command as per your Linux distributions:

$ sudo apt install eog                     #For Debian/Ubuntu-based
$ sudo yum install eog                     #For CentOS
$ sudo dnf install eog                     #For Fedora

View PNG

After installing the eog image viewer, you can run the below command to view the PNG file.

$ eog Linux.png

The eog image viewer can also display images in a slideshow mode, with the option to set the delay time between images and configure the transition effects.

View a PNG File Using a GIMP Image Editor

The GNU Image Manipulation Program, or GIMP, is a powerful and versatile image editing tool that is available at no cost. Similar to Adobe Photoshop, GIMP offers a variety of capabilities, including image retouching, composition, and authoring.

Install GIMP

If you are looking for a tool that is not only able to open the PNG files but also do other modifications to the image, then you should use the GIMP image viewer.

$ sudo apt install gimp            #For Debian/Ubuntu-based
$ sudo yum install gimp            #For CentOS
$ sudo dnf install gimp            #For Fedora
$ sudo snap install gimp           #For Snap Enabled Distros 

View PNG

You can open a PNG file using the below command in the terminal:

$ gimp Linux.png

You can also launch the gimp application then select the file and then select the “open” tab option as well to view your desired png file.

Conclusion

To view a PNG file on Linux, a web browser, eog image viewer, feh image viewer, and the GIMP utility can be used. A PNG file is a type of image with a small file size while maintaining the quality of the original image as it uses a technique called lossless compression. This post has explained various methods to view a PNG file in Linux.