Linux Commands

How Do I View A PNG File in Linux

Since the invention of the first camera in 1888, images and photos have been vital in conveying information and keeping evidence of events. With the rise of modern technology and social media, it’s now more important than ever to store, view, and edit images.

Being a popular and fantastic operating system, Linux provides a collection of tools and utilities for viewing and editing images. This tutorial discusses various ways to view a popular image format, PNG, in Linux.

What is a PNG file?

Portable Network Graphics, or PNG for short, is an image format that uses a 24-bit color system. It is ideal for storing digital art such as flat images, icons, and logos. PNG is a popular image format supported by a wide range of tools.

Advantages of PNG

The following are advantages of using the PNG file format:

  • PNG uses lossless compression, thereby preserving image quality.
  • It is suitable for digital media, making it ideal to use on web pages.
  • It uses 24-bit color, which supports over 16 million colors.

Disadvantages of PNG

Disadvantages of using PNG format include:

  • Large file size
  • Not well suited for photographic images.

How to Open A PNG file in Linux

The Linux operating system has a wide selection of tools you can use to open a PNG file.

However, due to the scope of this guide, we will only list the best ones based on our experience.

gThumb

gThumb is a lightweight and open-source image browser, manager, viewer, and editor. It allows users to perform various image operations in one tool.

To install it, use the command:

sudo apt-get install gthumb

To launch the tool, use the gnome-search:

gThumb will launch in the Pictures directory. You can navigate the filesystem to the location of the image you want to view.

To launch the image from the terminal with gThumb, use the command:

cd ~/Pictures

gthumb linux.png &

NOTE: Replace the linux.png with the name of the png file you want to open.

Shotwell

Shotwell is a simple photo manager that comes pre-installed with Ubuntu systems.

It supports image imports, image organization, basic editing such as rotation, cropping, enhancing, and more.

To open a PNG image with Shotwell, search for the tool in the gnome-search tool and launch. This will import all images in the Pictures directory.

To open a specific tool, double-click the image from the list.

Feh

For terminal users, feh is a great tool to view PNG files. It is a lightweight and straightforward tool that uses command-line arguments.

To install it on Linux, use the command

sudo apt-get install feh

To view a PNG image with feh, pass the file name as:

feh --auto-zoom ~/Pictures/linux.png

Feh will launch the image and window size respective to the image size. To control image display and how the tool works, consider the feh manual pages.

Nomacs

Nomacs is another popular tool you can use to view PNG images in Linux. It is free, open-source, and supports all major image formats.

To install nomacs on Linux, use the command:

sudo apt-get install nomacs

To view a PNG image with nomacs, launch the tool. Then, in the top menu, select Open and navigate to the image location.

Conclusion

There is a vast collection of tools you can use to view and edit PNG images. The best image viewer to use depends on the necessity; if you are a terminal user, stick to terminal-based image viewers.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list