How to Optimize Images Using TriMage in Linux

Sometimes we need to optimize our images so they can take up less disk space and load faster in our websites. A very nice and easy-to-use tool for everyone that can help us optimize our image files for the web by removing EXIF, other metadata and unnecessary comments is Trimage. This image optimizing program is inspired by ImageOptim which is another open-source program used to optimize image files in machines that run Mac Os X.

How to Install Trimage in Linux

Before installing the Trimage program in your machine make sure that your machine meets the following requirements:

  1. python 2.6
  2. python-qt4 4.4
  3. optipng
  4. pngcrush 1.6.7
  5. advancecomp 1.15
  6. jpegoptim 1.2.2

Debian And Ubuntu

To install Trimage in Debian and Ubuntu just type the following command.
sudo apt-get install trimage
As you can see from the above command, we use the apt-get commandline utility to install the Trimage image optimizer program because it is included in the official repositories.

Arch Linux

Trimage is available from AUR. Arch users have to type the following command in order to install the program in their machine.

yaourt -S trimage-git

Mandriva Linux 2010.1

Trimage is available Via two RPMs provided by Mandriva international backports Trimage 1.0.5 32bit Trimage 1.0.5 63bit


Trimage is available for a variety of versions: 11.3, 11.4 and Factory and SLE. You can find them on

Install Trimage From Source

But if you are the type of linux geek that likes to experiment with commands in the terminal then you can install Trimage from source by downloading it via git or bzr. Download the Trimage's repository from github as a zip file by using the following command in your terminal.


Unzip the zip file with the following command.


Change directory so you can install Trimage.

cd Trimage-master

Then enter the following command in your console to install Trimage.

python install

Note: This will not work if you have not installed the requirements.

How To Use Trimage

how to optimize images in linux

After the installation of the tool is finished you can launch it directly from the terminal with the trimage command or by going to Applications, Graphics and then select and click on Trimage image compressor. You will be presented with a very small window that makes the tool look very easy to use, even for people that are novice computer users.

If you come from a Mac OS X background and are familiar with the ImageOptim tool you will see that the tools look like they are the same app. The two following screenshots are taken in Mac OS X and Ubuntu machines. The first one shows ImageOptim tool running in a mac computer and the second one in an Ubuntu Linux machine.

how to optimize images in linux

ImageOptim running in Mac OS X.

how to optimize images in linux

Trimage running in my Ubuntu Linux box. At the moment I am writing this article the Trimage program supports only PNG and JPG image files and many planned features are expected to be included in the near future. To compress an image file with Trimage image compressor program just click on the Add and compress button like shown in the following picture.

Select the image you want to optimize and double-click on it. The program will automatically start the compression and at the end will give you information about the old size of the image, the new size and the compression amount.

1 thought on “How to Optimize Images Using TriMage in Linux”... add one

Leave a Comment