How to Optimize Images in Linux Using Trimage


Why would one optimize images in Linux? For sure to make some space to let some new family photos let in or make room for new images for web development reasons. The possibilities are unlimited. It doesn’t matter what your purpose is to optimize images, but if your tools are not doing what they were supposed to do, you are missing something.

In this guide, I will help you to install and operate a piece of software that will change the way you used to optimize your images on your system. I am using the Debian 10 Buster edition and all the commands work for related variants. You should still not be running commands without understanding your operating system-related instructions.

Install Trimage

Installing Trimage on Debian is as simple as installing any regular package. Simply follow along with the commands given below, and you’ll be all set.

$ sudo apt update
$ sudo apt install trimage

There aren’t any dependencies to make the installation complicated anyway. This will install both GUI and CLI setups.

Meet Trimage

Trimage is the image compressor for the Linux world. It can optimize images for web use. All image files are losslessly optimized on the highest available compression level. All EXIF and other image metadata are removed. Trimage is free open-source software available for Debian, Ubuntu, and related distributions that use .deb format to install packages. It offers both CLI and GUI-based user interfaces.

Let’s do some magic here:

Trimage has a straightforward graphical user interface. It takes an unlimited number of images and compresses them in the blink of an eye. You can always recompress them with a single click until the image can no longer be compressed.

At this time, Trimage only optimizes PNG and JPG formats. It can always be enhanced if you know how to code.

Let’s optimize a full directory of images now.

We are selecting a full directory as shown below:

Trimage will list all the images and begin the process as you can see in our screenshot.

Trimage On CLI

Trimage is as simple on CLI as in GUI.

With the help of a few commands, you can reduce the size of an unlimited number of images in a directory.

The best way to optimize images via CLI is to run the below command from a directory and you are good to go:

$ trimage -d . -q

You’ll get optimum results with less clutter.


In this article, we learnt how simple it can be to optimize any type of JPEG and PNG images to save some precious disk space on your computer. We are always happy to guide you through your difficult issues here on LinuxWays. It’ll be a pleasure to have your feedback for a greater motivation to bring the best of Linux.

You might Read

Best Photo Editors for Linux

Similar Posts