Lossless Image Optimization/Compression with Trimage on Ubuntu

The image resolution capability of today’s photo capturing devices like smartphones and digital cameras is increasing day by day. The real deal comes when we have to share these images, upload them on a cloud, or even save them on a device with restricted storage. Graphic designers also have to deal with the same issue but they are well-equipped with tools that can compress the images so that they can be easily shared with the stakeholders.

For Ubuntu users, the simplest and the most efficient solution to this issue is the Trimage image compressor. Trimage is a cross-platform GUI and command-line interface to optimize image files via optipng, advpng, pngcrush, and jpegoptim, depending on the filetype (currently, PNG and JPG files are supported). All image files are losslessly compressed on the highest available compression levels. Trimage gives you various input functions to fit your own workflow: A regular file dialog, dragging and dropping and various command line options.

In this article, we will explain how you can install Trimage on your Ubuntu both through the UI and the command line. We will then explain how you can launch and use this tool to losslessly compress images through your Ubuntu.

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.

Install Trimage Image Compressor through the Ubuntu UI

Installation

For a person who does not want to open the Command Line much, installing software present in the Ubuntu repository through the UI is very simple. On your Ubuntu desktop Activities toolbar, click the Ubuntu Software icon.

Ubuntu Software center

In the following view, click on the search icon and enter Trimage in the search bar. The search results will display the Trimage Image Compressor as follows:

Search for Trimage Image Compressor

This is the package maintained by Ubuntu Bionic Universe repository. From the Software Manager, click on the Trimage entry to open the following view:

Install Trimage

Click the Install button to begin the installation process. The following authentication dialog will display for you to provide your authentication details as only an authorized user can install software on Ubuntu.

Authenticate as admin

Enter your password and click the Authenticate button. After that, the installation process will begin, displaying a progress bar as follows.

Software is being installed

Trimage will then be installed to your system and you will get the following message after a successful installation:

Launch Trimage

Through the above dialog, you can choose to directly launch Trimage and even Remove it immediately for whatever reason.

Remove Trimage Image Compressor

If you want to remove Trimage that was installed using the above method, you can remove it from your system as follows:

Open the Ubuntu Software Manager and search for Trimage. You will see the “Installed” status in the search entry. Click this entry and then click Remove from the following view:

Removing Trimage

Then, the system will prompt you with an Authentication dialog. The software will be removed when you provide the password for sudo user and click Authenticate on the dialog.

Install Trimage on the Command Line

Installation

Trimage image compressor is easily available in the official Ubuntu repositories and can easily be installed through the command line using the apt-get command.

Open your Terminal application either through the system Application Launcher Search or through the Ctrl+Alt+T shortcut.

The next step is to update your system’s repository index through the following command:

$ sudo apt-get update

This helps you in installing the latest available version of a software from the Internet. Please note that only an authorized user can add, remove and configure software on Ubuntu.

Now you are ready to install Trimage; you can do so by running the following command as sudo:

$ sudo apt-get install trimage

Install Trimage with apt

The system might ask you the password for sudo and also provide you with a Y/n option to continue the installation. Enter Y and then hit enter; the software will be installed on your system. The process may, however, take some time depending on your Internet speed.

You can check the version number of the application, and also verify that it is indeed installed on your system, through the following command:

$ trimage --version

Check Trimage version

Remove Trimage

In case you want to remove the Trimage application through the command line, run the following command as sudo:

$ sudo apt-get remove trimage

Enter y on the y/n prompt and the software will be completely removed from your system.

How to Use Trimage for Image Compression

You can access Trimage from the Ubuntu application launcher bar as follows, or directly access it from the applications listing:

Trimage icon

Alternatively, you can use the following command in your Terminal to launch Trimage through the command line:

$ trimage

This is how the Trimage UI looks like:

Trimage Image Compressor

It lets you add image(s) for compression in two ways:

  • Through the Add and compress button that lets you browse to the images you want to add
  • By dragging and dropping the images to the Trimage window

Optimizing and Compressing Image files

I have added a file through the Add and compress button and Trimage has automatically compressed it by 4.8 %, and that too losslessly. You can even try Recompressing your photos if they have more potential to be optimized, otherwise, the tool will skip compressing the images.

This was all about the simplest image compressor for Ubuntu, that does the job perfectly!