/image/optimize bot broken?

Archived from the Transloadit support forum. Originally posted on July 4, 2014; details may be outdated, see our docs for current behavior. Original thread

Hi,

when running “so-crazy.png” trough the /image/optimize bot test on https://transloadit.com/docs/conversion-robots#reduce-image-file-sizes it returns the file without any file optimization. It still has a filesize of about 120 KB. But when I run the file several times trough http://tinypng.org I’m able to reduce the file size down to 32 KB without loosing quality! What is the problem here? There are several good and free implementations of libs that reduce png file sizes…

Simon

Hi Simon,

Ok that’s odd, do you also have an assembly id for me? Then I can debug better for you.

Kind regards,
Kevin

Template: REDACTED

Assembly: REDACTED

Hi Simon,

I just tested with that assembly and it trims down the size of the screenshot from 1.4mb to 175kb. That’s a factor 8 smaller, so I probably wouldn’t call the tool broken.

But obviously if you’re able to achieve an even bigger factor, that’s what we should at least be aiming for.

We’re currently using the optipng to do this. Have you tried multiple runs through our tool as well? If that’s better we have have to consider abstracting that away for you and run it multiple times ourselves.

If that doesn’t help we could investigate using a different tool such as http://pngquant.org/.

One final thing, maybe the tinypng trips metadata? We don’t do so by default as it’s considered bad internet citizienship (removing copyright of photographers and such should not be default behavior).

Best,
Kevin

Hi Simon,

We have introduced pngquant for you. It’s the same tool used by tinypng and kraken.io. Here’s how you would enable it using our image/optimize bot: https://gist.github.com/kvz/a2dec814253354bcf155

Since pngquant cannot preserve metadata, we have chosen that setting preserve_meta_data to false is mandatory. That’s so that accidental meta/copyright stripping (frowned upon by good internet citizens) is less likely to happen.

It’s still beta so there are no docs. You’ll be the first one to try it out so we’re also looking forward to your feedback! : )

Kind regards,
Kevin

Cool, cool, cool. Thanks a lot!

Hi Kevin,

Thank you very much!

I implemented pngquant thing into our template twice. But it feels like it not working better. https://transloadit.com/templates/view/REDACTED The images that are produced can still be decreased by more than 50% by tinypng.org.

Simon

Hey Simon,

I’m finally revisiting this issue. I’ve tried to reproduce your findings but so far I’m unable to. For instance, with the image attached, we get similar compression rates with pngquant turned on (tinypng goes from 198.0 KB to 69.3 KB - we to 73.2 KB). Those are rates I can live with for something that’s we offer as a sidedish : )

Can you maybe attach 1 image that performs really bad? I would love to add that to our test suite and then try some more options.

Kind regards,
Kevin

Hi Kevin!

in the meanwhile I get the same results as you 3-8% less than tinypng - which is totally fine :slight_smile:

I think my “bad” experience directly after you send me the first draft of pngquant resulted because of the API was not published at that time or whatever.

All fine now! Thanks.

Simon

Hey Simon,

Ok excellent! I’ll start working on the docs & blogpost then so others can too benefit from this improvement. Just a thought, would you like to be featured in the blogpost with a link to your site and a nice quote, or not interested in that?

Kind regards,
Kevin

Hi Kevin,

definitely!!! Today we prepare our global launch for our Yarnee App so this would fit perfectly :slight_smile:

The App https://itunes.apple.com/app/yarnee/id878999441
The Homepage: http://yarnee.com/
The Yarnee service on the web: https://yarnee.com/app

Some technical background how and why we use TL: (You can use this to cite us)

Yarnee is a tool to create collections of media that else would go lost in the feed based services like T, FB and Instagram. With Yarnee you can keep things together.

- We use TL to be able to develop very fast.
- We use it to compress, crop images and storing them (S3)
- We use the audio wave robot to visualize audio files
- We also use HTML to PNG robot, and the wave form generator to visualize audio files inside the App.

About the PNG compression request:

When a Yarn link is shared on FB we tell FB via Open Graph to display an interactive flash object. FB offers to display a nice preview image of the Open Graph content. We wanted to have a nice preview that indicates to the users what they can expect. So we have HTML website that displays 4 circles of the first 4 pages of Yarnee nicely formated with CSS. This is captured via the html/capture(?) robot and stored as PNG. To get FB to accept those images it was very important to reduce the file size of those created PNG so we use the new png compression to get nice FB previews :slight_smile:

Any further questions? Feel free to ask.

You can quote me or another developer of the team with:

“Without TL we would not be able to focus on our core features in our iOS APP” or “TL helped us to develop Yarnee without thinking of image and video compression!”, or something similar.

Simon

Hi Simon,

Excellent! I had to trim it down to a few sentences for this particular blogpost. I hope I captured it: https://transloadit.com/blog/2014/07/better-png-optimization/
Let me know if it’s alright like that or if we need to fine tune a little?

There’s much more good material in your response. I’ve saved it in a case-study folder in our site. At a later point we want to design a few good ones, and you’ll definitely be among the first to hear from us then!

Let me know how all of this sounds!

Kind regards,
Kevin

Perfect!

Great, closing this then.
And good luck with the launch of Yarnee!!

Best,
Kevin

> There’s much more good material in your response. I’ve saved it in a case-study folder in our site.

Sure!