A few customers have mentioned our PNG optimization is sub-par. Even though we were already able to cut down large PNGs by factor 8 in size, they reported dedicated services like TinyPNG and kraken.io did even better, especially for smaller images.

Obviously if they are able to achieve bigger savings, that's what we should be aiming for.

We started researching different tools and ended up with pngquant. Today we are launching it as an extension to our existing /image/optimize robot. We're not making it the default, since:

  • that would break backwards compatibility
  • this tool cannot preserve meta data

Preserving meta data is considered good internet citizenship, as there might be copyrights in there. That's also why - if you want to use pngquant - we make it mandatory to set the preserve_meta_data option to false, in addition to specifying the png_tool. We want to avoid people accidentally stripping ownership information.

Here's how a Step could look like in your templates:

optimize: {
  robot             : "/image/optimize",
  use               : ":original",
  preserve_meta_data: false,
  png_tool          : "pngquant"

As with all bots, you can plug this bot right on top of another bot like LEGO®, so your video thumbnails, uploaded avatars, etc, are automatically stored in an optimized way.

After testing with customers, we were able to get 65% reductions for medium sized images, only a few points off of services like TinyPNG and kraken.io.

Simon from Yarnee:

With Yarnee you can create collections of media that otherwise would go lost in feed based services like Facebook. We were already using Transloadit's /html/convert bot to capture previews, but in order to be accepted by Facebook they had to be reduced in size. With Transloadit's new compression we were able to get it to work beautifully!

We'll keep optimizing to squeeze out those last few percent, but wanted to share the goodness with you already :smile: