PNG or Portable Network Graphic files are much in demand due to their flexibility and ability to showcase transparent pixels. Most icon and Software based products use PNG as a default image source. However, PNG files are rather large and can take much of your storage space. Where each PNG file can range anywhere between 1 KB to 5MB, it’s important to compress these files. If you have a Linux OS, then you can even compress PNG files in batch to save your time and process.
PNG are great for development work, now even comes cameras have a default output as PNG files. PNG can hold great colour detail and object information. But all of this info can create a big PNG file. And in order to serve your purpose, you might need to compress it down to a suitable size package.
Linux comes with inbuilt tools and services that can help you to compress PNG files. But in most cases, they offer a CLI (Command Line Interface) to compress PNG files which is not a very easy thing to do, especially if you’re a beginner. Today in this guide, we will help you to compress your PNG files using a Linux machine, both for single and batch process.
How to Compress PNG Files on Linux
The easiest way to compress or perform any operation on image files is by using an image editor on Linux. You can use free to use software such as GIMP or Pinana editor. These will give you robust control over what changes you do to your pictures in a more graphical way. But if you like the CLI method for fast execution, that’s possible too.
Method 1: Using GUI software
There are multiple softwares available for PNG compression or any kind of compression. Most of them are free such as GIMP, Pinata, Trimage lossless compression etc. If you already have GIMP or any other image editor installed, you can easily do the editing process and decrease the size of your PNG file. If now, here is an easy drag and drop procedure to compress PNG files on your Linux machine.
Download and install Trimage lossless compression on your Linux via the command line.
sudo apt-get install trimage
After successful install, open Trimage software.
Drag and drop your PNG files and they will be compressed accordingly. You can drag and drop multiple files for batch processing.
Trimage has multiple controls on the way your files are compressed. So if you want more compression, you can change the preferences accordingly.
Method 2: Using CLI interface
Linux is famous for its CLI interface as you can open programs and perform multiple operations using the Linux terminal or CLI (command line interface). Although Linux do not have an inbuilt system for image compression, but you can easily instal one. The one the works best is OptiPNG.
Download and install OptiPNG on your Linux machine.
sudo apt-get install optipng
After successful install, run OptiPNG command as follows.
This process is to compress one single PNG file. If you wish to compress multiple PNG at once you can add all PNG files to a folder and run a command like this.
Via this method, all the PNG files inside the folder will compress instantly.
If you’re not an experienced Linux OS user, then you might care difficulties install software such as OptiPNG or Trimage. For such issues, you can use the command lines to update your sudo apt package.
sudo apt-get update sudo apt-get upgrade
After using these commands, you will be able to use download and install the required packages for this particular guide.
PNG files can be tremendously big and can hamper the workflow or ay cause storage issues in the long run. In the case of software development, PNG files can take much storage and make the final product very bulky for the end-user. So whether you are a developer or a normal user saving his holiday pictures, always compress your PNG files to save up space and time.