Kilian Valkhof

Building tools that make developers awesome.

Trimage image compressor

Apps, Web, 24 March 2010, 3 minute read

As a front-end developer, minimizing your images is important. Compressed images load faster and take less time to download. However, most current tools that can do that are command line applications that only support one type of image, and oftentimes do not have the same API. To scratch my own itch I build a cross-platform GUI image compressor.


Trimage is a GUI front-end to a couple of command line tools available on most linux based systems (though it should work on mac and windows, too), and can losslessy compress both PNG and JPG files. It looks native, (dare I say) pretty and is very easy to use.

That’s why Trimage has multiple ways of accepting files: You can drop them onto the app, you can open them via a file dialog, and you can feed it images or entire directories via the command line. So you can pick the method you find most comfortable, and use that.

More information can be found on the website:

screenshot of trimage

How to install

For the moment, I only have installation guides for Ubuntu and other linux-based systems. If you can help me with Mac and Windows, please e-mail me at [email protected]!


Ubuntu is by far the easiest to install. If you’re on karmic or lucid, simply enter this into your console:

  1. sudo add-apt-repository ppa:kilian/trimage
  2. sudo apt-get update
  3. sudo apt-get install trimage

If you are still on Jaunty, read this guide on installing PPA’s.

Other Linux:

I’m still looking for help with making .debs, .rpms and the like, but you can install Trimage via python as well:

  1. Download the source via GitHub or Launchpad
  2. Make sure you have all the requirements installed: python 2.6, python-qt4 4.4, optipng, advancecomp 1.15, jpegoptim 1.2.2, or higher versions
  3. Enter python install into your console
  4. Launch by executing trimage

Why and how

As I said in the intro, I wrote this mostly to scratch my own itch. I wanted an easier way to compress my files that didn’t involve mucking about on the command line or uploading all my images to some server far away via a crappy flash application.

Trimage was inspired by ImageOptim. It is made using python and the PyQt GUI framework. The choice for PyQt was made for a couple of reasons: the Qt4 designer is very easy to use, it’s available cross-platform and most importantly, it provides native widgets. As the latter is my number one annoyance, and I actively avoid using programs that do not look like they belong in my gnome desktop, this was a big issue for me. Paul Chaplin helped me with a lot of the python stuff.

However, PyQt has some downsides as well. For one. The documentation is bad. It’s not complete, hard to read and sometimes isn’t even correct. That’s not to say it’s unusable, but it clearly needs some more love.

Where the documentation lacks however, the #pyqt IRC channel on freenode is awesome. There are a bunch of really smart and nice people there that go out of their way to help you. Every community should be like this.

If you want to build a GUI app for Ubuntu using python, the best start you can get is PyAppTemplate by Neil Wallace, which takes care of all the Hoohaa and voodoo that goes into a and the debian build files. It took me a day to try and figure it all out by myself, and then an hour to get it working using PyAppTemplate.

Future development

As you can see on the website, I have a bunch of features lined up for the coming versions. All development is done on GitHub, so if you want to help out, add more options or scratch an item from the todo, I appreciate all help!

Polypane browser for responsive web development and design Hi, I'm Kilian. I make Polypane, the browser for responsive web development and design. If you're reading this site, that's probably interesting to you. Try it out!