Oct
8
2010

Smush Your Images

smushitOptimizing images is something you should always do for websites. No  excuses! If you aren’t doing it, start now. Seriously, it saves bandwidth for you AND your readers. Yahoo even provides a service (Smush.it) to make it simple.

That being said, my wife loves pictures. Every Wednesday she chooses the best from the previous week and shares them on her blog. She uses Windows Live Writer to compiler the post, and likes to add effects to the images before they go out. This makes optimizing them really annoying because I had to go do it after the post was complete. 

I started to look around to see if there was a plugin for Live Writer that would send all images through Smush.it before uploading the post, but nothing seemed to be there. I figure I would buckle down and knock one out in a night. After an hour or so of hacking, I present to you Smushy.

It is really quite simple. When you are creating a new post (sorry, it doesn’t work for updating because I didn’t want to have to worry about sending already smushed images through their service again) it pulls all image tags out of the HTML, runs them through the service, and overwrites the one on disk with the optimized one.

It should be fine, but as always, use at your own risk. Please leave feedback below, and let me know if there are any bugs.

One last thing, the more images you have in the post the longer it is going to take. It currently send them off one at a time.

Smushy.cs (3.31 kb)

Add comment




biuquote
Loading


AdSense

Software engineer by hobby and trade. When I am not sitting in front of a computer, you can find me playing with my kids. I am lucky enough to be married to my best friend and high school sweetheart. Life couldn't be better!

 

All content is mine, not my employers

Chronology

Tweets

what is the easiest way to *just* the last changeset number from git?
21 hours ago via Silver Bird
@ParasValecha so it is a virus some marketing guy manage to win an award for? ;)
3 days ago via Silver Bird
@ParasValecha none. I think they are one of the worse "viruses" you can get. Thrashing your disk and hogging CPU any chance they get
3 days ago via Silver Bird
...i have gone 5 years without one and been fine
3 days ago via Microsoft
... and provide little value on a day to day basis. Don't go to random content, and don't open stuff you don't understand...
3 days ago via Microsoft
I wholeheartedly believe that virus scanners are one of the worst things to install. they really slow down your computer...
3 days ago via Microsoft
RT @CodeWisdom: "When your hammer is C++, everything begins to look like a thumb." - Steve Haflich #fb
5 days ago via rowi for Windows Phone
Follow me on Twitter