Mechanical Shark

TinyPNG
Automated image compression utility

TinyPNG
Automated image compression utility

I am giving TinyPNG a go because Lighthouse is moaning about image sizes on one of my websites. It's an automated image compression service/API/panda that does smart PNG/JPEG compression, and it's free for light usage (<500 images a month). 

In literally 3 lines I got it working, which has to be one of the lowest barriers to entry for any utility I've tried. And I'm running my CMS in debug while typing this post and testing it with this stormtrooper pic. (The revolution will be live.)

I've got a method with a byte array in it already (called "blob") that gets converted to a Stream before it's uploaded into blob storage. After exchanging my email address for a developer key and installing the "Tinify" nuget package that code changes to:

Tinify.Key = "yourkeyhereblahblahblahblahblahblah";
var resultData = Tinify.FromBuffer(blob).ToBuffer();
minifiedStream = new MemoryStream(resultData.Result);

The source image was a full res iPhone shot (2.5Mb). Resulting blob that got sent to storage... 937Kb. Which is still huge, but not as huge. I'm assuming further optimisations could be achieved passing params to resize the image, set compression, tweaking the starboard power coupling, etc. Of course, there should also be some async/await shennanigans in there. And error handling. Whatevs. 

But TinyPNG? Working image compression in 3 lines of code? Yup.

Officially certified: Nifty.

Now to read the documentation and implement it properly...

Posted Wednesday, February 14, 2018.

NEXT: A Lack of Focus.

Or, "It ain't like it used to be."

PREVIOUS: Late nite, early warning.

Or, “Is this thing on?”

Field test

The future of Future Sound Of Disco.

Confession

2K18 -> 2K19

Anti-social networking

Sell your eyeballs direct!

Planned Obsolescence

Hickory Dickory Docker, Part 2

In which we achieve BMD (Bare Minimum Docker).

Hickory Dickory Docker

Noobing containers, a personal "journey".

A random deployment.

Or, "I am starting a music blog."

Experimental antique imaging.

Or, "Capturing 8-minute-old photons with a 30-year-old camera."

Purveyors of splendid IT solutions.

Est. 2013, London.

Company registered in England and Wales No 8696863.

Purveyors of splendid IT solutions.

Est. 2013, London.

Company registered in England and Wales No 8696863.

Previously

The long wait for long form.
Or, "I have decided to resurrect the blog, guv"

Archived Posts