Most web developers know the importance of optimizing images for faster page loading times, but it’s also a very cumbersome, time consuming and boring process. Then when you are done, the customer or designer gives you new images to use and you can start the process over and over and over again. The result is that we spend a lot of time optimizing images and also forget to do it from time to time.

That’s why I’ve been experimenting with a way to automate the process of optimizing images for use on web pages. This has resulted in a Visual Studio 2010 extension to do just that.

The extension

The idea with automating the optimization is that the images must have the same quality in color and fidelity as before they were optimized. That is done with proven algorithms, and when an image has been optimized, it cannot be further optimized by the same algorithm. Nothing happens if you run the optimization multiple times on the same image – it will only be optimized the first time.

If you run the optimization on an image that has already been optimized using other tools, you might still be able to optimize further, but often nothing will happen - the image will not be touched when it has been analyzed and no optimization is found possible.

In this beta of the Image Optimizer extension, only JPEG and PNG files are supported, but that should hopefully cover ~90% of images in modern websites.

When you right-click a folder in the Solution Explorer in Visual Studio, you now have a new menu item called “Optimize images”.

When clicking the menu item, the image optimization starts. It looks for all images in the clicked folder and all its subfolders. You can also select multiple folders before right-clicking. As the images are processed, the result of the optimization is printed to the Output Window in Visual Studio.

The extension uses OptiPNG for optimizing PNG files and jpegoptim for optimizing JPEG files. I will go into more details about how it works in the coming weeks when the extension is more polished and open sourced.


Please try it out and give me any feedback that will help improve it.

Download the extension in the Visual Studio Gallery


I’ve used Google’s Page Speed plug-in for Firebug a lot since it was released last year. Even though it’s not as good as Yahoo’s YSlow plug-in, it’s still very usable for some scenarios YSlow doesn’t support – my favorite being the analysis of unused CSS and selector optimizations.

It also has a feature that will tell you how much your web page will gain by minifying the HTML.

Not only does it analyze the difference but it can also generate an optimized version of your HTML. It removes unnecessary whitespace which in most cases are pretty harmless. But, it does more than that. It actually strips out attribute quotes from the HTML elements as well as remove the closing </body> and </html> tags. This renders the entire page invalid according to any WC3 (X)HTML standards. 

Even though it is a good idea to minify your HTML, this feature of the Page Speed plug-in makes it completely useless to me. Unless you’re Google, Twitter or Facebook, this feature is just strange.


At the Mix10 conference, the Windows Phone 7 teams had some very big announcements – a lot of it had been kept secret and first revealed to the public now. There is however still some details they keep secret. Some of these secrets are the user agents of Internet Explorer for Windows Phone 7, which they simply wouldn’t give us.

After playing with Windows Phone 7 we managed to secure a copy of the user agent string. The user agent for IE on Windows Phone 7 running on the Asus Galaxy device is:

Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) Asus;Galaxy6

Notice that it identifies the browser as IE7 and the operating system as Windows Phone OS 7. The IE team told us that the browser in Windows Phone 7 is a mobile version of IE7 with certain features ported from IE8. So it doesn’t use the full Trident 4 layout engine that IE8 uses, but instead Trident version 3.1 with a few extra capabilities.

The user agent was retrieved from server logs, so it is the actual user agent from the actual browser.


My grand plan of 2009 was a new year’s resolution that would take me around the world. The plan was simple:

In average, I need to visit a new country that I may have visited before, every month of 2009.

Last time I wrote about my plan on this blog, I just got home from Greece and Albania in July and the plan looked to succeed. According to my original plan, I had to go to Egypt and Monaco this fall, but unfortunately that never worked out. So instead, here’s how the grand plan of 2009 ended.


This was a good month that began with a trip to the Fringe Festival in Edinburgh, Scotland with one of my Scottish friends. It’s the world’s biggest arts festival and a lot of fun with hundreds of venues. I saw some excellent comedy acts.

Mads Kristensen in Edinburgh

A week later I did a major travel mistake – underestimating jet lag. I flew to Boston on a Friday morning and back home Sunday afternoon. So a small trip with an 8 our flight both ways. I landed in Copenhagen airport Monday morning at 9am and went directly from the airport to the office. I won’t do that ever again. Well, I probably will…

Mads Kristensen in Boston


The plan here was to go to Monaco and win big on the casinos, but alas, my travel buddy backed out.


It proved that the best trips in 2009 where the last two ones. In the middle of October I took a 12 day guided tour through the major cities and sites of Iran - Tehran, Shiraz, Isfahan, Yazd and Qom. Iran is filled with sights and relics from the Old Persian Empire and it totally changed my views on Iran. I also got the chance to meet Keyvan Nayyari in Tehran.

Mads Kristensen and Keyvan Nayyari

On the way home, we had time in transit in Istanbul airport in Turkey. So we ventured out to see the Blue Mosque and the Bosphorus Strait. It was also in Istanbul we had our first beer in 12 days, because alcohol is banned in Iran.



My parents were invited to a wedding in India and as soon as I heard, I wanted to tackle along. I’ve seen pictures of Indian weddings before and there was no way I would miss that opportunity. The groom was so kind to invite me as well and another big adventure unfolded. Only 2 weeks separated the trip to Iran and India. We started at the Fort Aguada resort in Goa for a couple of days before the wedding, then 4 days of constant partying with the bride and groom and then a few days in Mumbai before heading home.

Mads Kristensen in Mumbai


And with this the grand plan of 2009 succeeded and my goal was reached. Here’s a list of the destinations I visited in 2009 in chronological order

  1. Düsseldorf, Germany
  2. London, England
  3. Chişinău, Moldova
  4. Seattle, Washington
  5. Malmö, Sweden (this one doesn’t count since it’s a ½ hour drive from where I live)
  6. Malaga, Spain
  7. Gibraltar
  8. Stirling, Scotland
  9. Amsterdam, Holland
  10. Corfu, Greece
  11. Sarande, Albania
  12. Edinburgh, Scotland
  13. Boston, Massachusetts
  14. Tehran, Iran
  15. Mumbai, India

According to TripIt, that amounts to 73.000 kilometers which is almost twice around the world.

For 2010 my plan is more relaxed. So far I have planned a trip to South Africa, Las Vegas and Seattle – a mix of business and pleasure. Also, for summer my dream is to take the Transsiberian Railway through Russia to Mongolia and China, but no plans yet.


MVP award

When I was eating my breakfast at work Monday morning, the Microsoft developer evangelist Daniel called me on my cell phone. “Have you checked your mail?” he asked and I could hear in his voice that he was smiling more than usually. “Yes, of course” I replied, “Why?”.  “You won the 2009 MVP award in ASP.NET”. 

“SAY WHAT, for reals homes? That's awesome, but I didn't get the e-mail”. He assured me I won the award anyway, we hung up and I was really happy that I won the MVP. However, I did have a problem with the missing e-mail. What if Daniel was misinformed or some other mix-up had made me overly exited on false premise. I would be devastated if that was the case, since Daniel got me all worked up. Well, Daniel reassured me a couple of times during the day about the validity of his claim and that made me relax a bit.

Still, without that e-mail I wouldn’t know for sure…

Later that day I found the mail in Outlook’s spam filter, so now it's official.