Crushing PNGs in .NET

Updated on Sunday, September 30, 2018

Crushing PNGs in .NET

I'm working on page speed and Google PageSpeed Insights is telling me that my PNGs are just way too large. Sadly .NET does not provide any way to optimize PNG images so there is no easy fix - just unmanaged libraries and command line tools.

I have an allergy to manual processes so I've lashed up some code to automatically find and optimize PNGs in my App_Data folder using PNGCRUSH. I can call CrushAllImages() to fix up everything or CrushImage() when I need to fix up a specific PNG. Code below:

LEGO Management

Updated on Wednesday, February 22, 2017

LEGO Management

Good HBR article on LEGO and girls: LEGO’s Girl Problem Starts with Management, depressing conclusion:

"Don’t hold your breath, though. Despite its first-day sold-out success, LEGO has decided not to continue the Research Institute line. It was only a “limited edition.” So girls, back to the pool. The guys in this boardroom don’t seem to want to give you any ideas… let alone seats at the table."

(previously, previously)

Autumnal Equinox 2014

Updated on Wednesday, February 22, 2017

Autumnal Equinox 2014

Autumn starts now in the northern hemisphere, Spring in the southern. Rendered in Catfood Earth (Windows, Android).

(Previously)

Sunset sunset

Updated on Wednesday, February 22, 2017

Sunset sunset

Sunset over the Sunset district in San Francisco. There is also the start of moonset at the start of the video and then clouds roll in and, unusually, out before the sun goes down.

Cable Car Museum

Updated on Thursday, November 12, 2015

Please Stay

Updated on Wednesday, February 22, 2017

Please Stay

My Scottish Grandmother would always tell me off if I said I was English instead of British. She also said it was better to be moving in the wrong direction rather than standing still in the right one. That mostly applied to navigating traffic, but I think it's true for Scotland as well. Help make the UK better and don't become small and stagnant and some sort of irrelevant bland euro-region.

And if you do go then this.

San Francisco from Hill 88

Updated on Wednesday, February 22, 2017

San Francisco from Hill 88

Minify and inline CSS for ASP.NET MVC

Updated on Tuesday, April 7, 2020

ASP.NET has a CssMinify class (and a JavaScript variant as well) designed for use in the bundling pipeline. But what if you want to have your CSS minified and inline? Here is an action that is working for me (rendered into a style tag on my _Layout.cshtml using @Html.Action("InlineCss", "Home")).

Note that I'm using this to inline CSS for this blog. The pages are cached so I'm not worried about how well this action performs. My blog is also basically all landing pages so I'm also not worried about caching a non-inline version for later use, I just drop all the CSS on every page.

Book reviews for July 2014

Updated on Friday, February 24, 2017
Web Analytics 2.0: The Art of Online Accountability & Science of Customer Centricity [With CDROM] by Avinash Kaushik

Web Analytics 2.0: The Art of Online Accountability & Science of Customer Centricity [With CDROM] by Avinash Kaushik

5/5

Deep, evergreen advice on web analytics. This book is grounded in the trenches and is full of practical advice and reality. Works well to read all the way through and to dip into for specific topics.

 

The Divide: American Injustice in the Age of the Wealth Gap by Matt Taibbi

The Divide: American Injustice in the Age of the Wealth Gap by Matt Taibbi

5/5

Barnstorming tirade against injustice in the US law enforcement and legal systems. Nothing in here was news to me, but laid out story after story it's breathtaking. Minor welfare infractions leading to jail time, institutionalized fraud ignored. Banks get away with money laundering and theft while in some places standing on the street is a crime. Once you've worked up a full head of rage you realize that Obama is as bad as Bush is nearly as bad as Clinton. The failure is in politics and this book is a depressing catalog of the symptoms.

 

Tedious Feed Update

Updated on Wednesday, February 22, 2017

Tedious Feed Update

If you subscribe to I Thought He Came With You via RSS please switch to this new feed and delete the old one.

Longer version... this blog has used FeedBurner for ever but I managed to get locked out a couple of years ago. I upgraded to Google Apps for Domains and part of the process was transitioning various services over to a temporary account and then back to the new one. Most of them made it over but FeedBurner got orphaned somehow.

I've emailed, left forum posts etc but no luck. Google doesn't really do customer service so despite actually paying them I seem to be out of luck. Also, Google hates RSS so FeedBurner probably isn't the right long term tool even if I could get back into my account.

I've been meaning to do something about this for a while but as it was working it wasn't a top priority. This changed when my blog got hacked a couple of times in a row - I'm not sure if it was the software (I'd been using BlogEngine.net) or my hosting provider but it's painful to fix and I decided I needed a change. I Thought I Came From You is now running on a home grown platform. It should be more stable, faster (some quick benchmarking suggests twice as fast so far) and not get hacked quite so often.

So switch to http://ithoughthecamewithyou.com/syndication.axd for updates (I can't recommend Feedly highly enough) and delete the old feed. If you have any problems leave a comment below or send me an email.