A few customers have mentioned that our PNG optimization is sub-par. Even though we were already able to cut down the size of large PNGs by a factor of eight, these customers reported that dedicated services like TinyPNG and kraken.io were giving even better results, especially for smaller images.

Obviously, if those services are able to achieve bigger savings, that is what we should be aiming for as well.

We began researching different tools and ended up with pngquant. Today, we are launching it as an extension to our existing /image/optimize Robot. We are, however, not making pngquant the default, as that would not only break backwards compatibility, but also because this tool is not able to preserve metadata.

Preserving metadata is considered good internet citizenship, since it might contain copyrights. That is also why - if you choose 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 from their files.

This is what a Step could look like in your Templates:

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

As with all Robots, you can plug this Robot right on top of another one, like LEGO®. That will ensure that your video thumbnails, uploaded avatars, etc., are automatically stored in an optimized way.

After testing this new functionality with some of our customers, we were able to reach reductions of 65% for medium sized images, which is merely a few points away from services like TinyPNG and kraken.io.

Simon from Yarnee had the following to say:

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 Robot 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 will, of course, continue optimizing to squeeze out those last few percents as well, but we already wanted to share the news with you today. 😄

Enjoy!