Mike Swanson

  • Mike Swanson's Blog

    SEAMonster: A .NET-Based Seam Carving Implementation


    To avoid any potential confusion, this is a personal, spare-time project that has nothing to do with the cool Seadragon technology.

    Before you read my post, you should watch the short 4 1/2 minute video that demonstrates an image resizing technique called seam carving. The technique was presented at this year's SIGGRAPH 2007 conference by Shai Avidan and Ariel Shamir. If you want to know all of the details, check out the paper they presented called Seam Carving for Content-Aware Image Resizing (20MB PDF). Shai and Ariel outline a relatively simple algorithm for finding a "seam" of pixels that is least likely to be missed when it's removed from an image. The algorithm looks for connected pixels of low energy, where energy refers to a measure of visual detail. By iterating the algorithm, an image can be resized while maintaining its general structure. Unlike a typical stretch operation in your favorite graphics application, the seam carving technique resists squashing or distorting the image.

    When I first saw their video, I thought it was magic. Not only do they demonstrate resizing, but they also show how their algorithm can easily remove specific content (like a person or object) from a scene. It's easy to imagine how images can be resized using this technique for display on smaller devices like a cell phone. In their paper, Shai and Ariel briefly describe a method that would allow an image format with extended seam carving data to easily resize on-the-fly. Very cool.

    Inspired by their work, I thought I'd play around with the algorithm and methods in my spare time. So, over the course of the past week or so, I've put together a .NET-based implementation of seam carving that I affectionately call SEAMonster. The code has evolved from a very simple prototype to something a bit more robust. As these things go, the architecture is a bit shaky at the moment, but it does work. The early version of the application can only open JPG files, doesn't support image expansion, and the user interface is pretty minimal. However, it's far enough along that someone might find it interesting.

    If you'd like to take it for a spin, download SEAMonster_0.1.zip (63KB). The application requires the Microsoft .NET Framework Version 2.0 if you don't already have it installed on your machine. In lieu of documentation, I encourage you to watch the 8 minute video introduction I recorded to quickly get up-to-speed (note that you may need to download the TechSmith Screen Capture Codec to properly view this video).

    When I have the code under control, I plan to upload the project to CodePlex so that the developer community can contribute. All of the image manipulation functionality is encapsulated in a DLL, so it should be usable in most scenarios. There is a lot of opportunity for improvement and optimization in these algorithms, and I expect a lot of innovation to happen over the next few months. It should be fun to watch.

    Here are some other seam carving resources that you may find interesting:

    If you have any comments about this early version of SEAMonster, or if you have suggestions for the version I plan to release on CodePlex, please leave feedback (or contact me directly).

  • Mike Swanson's Blog

    IE9’s Stunning Text Rendering Quality


    If you follow my blog, you may know that I’m deeply involved in the planning and execution of our PDC, MIX, and Tech·Ed events (including Tech·Ed Europe). My team works on keynotes and content (sessions, hands-on labs, workshops, etc.), among many other things. As a matter of fact, I have an open position on my team for someone who can plan, build, and maintain the public and internal web tools for our big tier-1 events. Apply, if you’re interested. But I digress…

    During the lead-up to our MIX10 event this spring, I knew that one of the features that Steven Sinofsky and Dean Hachamovitch would show in our day 2 keynote (demo starts at 19:00) was the hardware-accelerated text quality in IE9. The feature takes advantage of DirectWrite, ClearType, and sub-pixel positioning to improve font quality and readability. This additional precision allows glyphs to start “within” a pixel and not just at their boundaries resulting in more precise and consistent glyph spacing and proportions. This article on ClearType does a good job explaining some of the magic, even though it’s focused on WPF.

    If you’re like me, when you hear “sub-pixel positioning” and glyphs that start “within” a pixel, you probably think, “yeah…right!” The MIX10 keynote demo certainly shows an improvement, but Steven and Dean had to zoom pretty far into the text to illustrate the difference. Fast forward to this past weekend.

    Recently, I’ve been spending time on an upcoming project for my good friends at MIX Online (just down the hall from me in building 24). The project involves working with the HTML5 canvas element, and I’ve been performing most of my tests with IE9 Platform Preview 3. This weekend, I decided to run some of my test files (HTML and JavaScript) with the latest versions of Firefox, Safari, and Chrome. Honestly, I didn’t expect to find many differences. So imagine my surprise when I saw these results (in alphabetical order):

    Update: Some users were reporting that IE8 was automatically resizing these images because of their width. So, I've cropped the images to avoid this behavior. If the images still look "squashed," you can click to view them directly.





    What a difference! Look at the rendering quality, readability, and positioning of the text. These are unmodified screenshots from the latest versions of the browsers running on Windows 7 with ClearType enabled. All of the text is rendered with the canvas .fillText command and there are no bitmap images…everything is either text or drawn to the canvas with vectors. I encourage you to try similar tests with your own content. I think you’ll be surprised!

    If want to learn more about the technology behind all of this, take a moment to read about the hardware accelerated canvas support in IE9 on the ieblog.

    And, of course, I love it when people take the time to send me a quick email. What do you think?

  • Mike Swanson's Blog

    Dinner with Steve Wiebe (of The King of Kong fame)


    This past Thursday evening, Ray Winninger, Jennifer Ritzinger, Arthur Yasinski, and I met Steve Wiebe for dinner at Pomegranate in Redmond, Washington. If you're not familiar with Steve, he's featured in the recent documentary, The King of Kong: A Fistful of Quarters. My wife and I saw the movie a few weeks back at Big Picture in Redmond and loved it. Even if you're not a fan of classic video games, this is a great movie (don't take my word for it).

    Immediately after the movie, I told my wife that I'd love to find Steve and take him to dinner (he lives in the area). He seemed like a great guy in The King of Kong, and although I don't hold any current records, I have held a few in the distant past, and I figured he'd be fun to spend some time with.

    I happened to mention the movie to Arthur at lunch one day, and it turns out that he lives just down the street from Steve...and has seen him playing Donkey Kong in his garage many times! :-) With Arthur's help, I was in touch with Steve's wife, Nicole, a few e-mails later, and it wasn't long after that that we had set a dinner date.

    Fast forward to dinner. Let me start by saying that Steve Wiebe is exactly as he is portrayed in the movie. He's polite, considerate, very likable, smart, and respectful of everyone he talks about. Steve was a mechanical engineer at Boeing where he worked on landing gear, and he's currently teaching seventh grade math in the area. We spent almost three hours talking and enjoying a great dinner. Among many "behind the scenes" stories, here are a few other tidbits from the evening:

    • Steve has liked Donkey Kong since his younger years, and they had a machine at his fraternity in college. The first time he reached the kill screen, he thought the machine was defective. Only later did he learn that this is the last screen in the game.
    • Steve doesn't play Donkey Kong while school is in session. I'm very impressed at his self-control!
    • Steve was aware of the Galaga bug that causes the enemies to stop firing for the rest of the game, but he didn't know the details. As a huge Galaga fan myself (remember my post, Make Your Own Mini-Galaga?), I was thrilled to add a little video game knowledge to the conversation.

    As a side note, before dinner, Ray, Jennifer, Arthur, and I decided to try our hands at Donkey Kong to see who could get the highest score (we have a machine in the office). If anything, it would give us an appreciation of Steve's amazing achievement of 1,049,100. After a couple of rounds, I happened to get the high score of 26,600...and that was on a machine that gives you six lives! Pretty sad.

    Thank you to Steve for saying "yes" to dinner. It was a fun evening!

  • Mike Swanson's Blog

    Problem Installing Expression Web on Windows Vista with Office 2007?


    Although I love our Expression Web product, especially for its CSS editing capabilities, I wouldn't consider myself an expert. I've used it to create some simple web pages and to edit the look-and-feel of my blog. But, over the past couple of weeks, two people have contacted me about problems installing Expression Web on their Windows Vista machines with Office 2007.

    If you take a look at the ReadMe, you'll see that: "You need to uninstall any pre-release version of the Microsoft Office 2007 system such as the Beta before installing Expression Web." Those instructions seem pretty clear. However, the two people who contacted me had "clean" systems that had been built from the ground up with the RTM versions of both Windows Vista and Office 2007. There were clearly no prior beta versions hanging around.

    After a bit of digging, it seems that if you have a version of the 2007 Microsoft Office Add-in: Microsoft Save as PDF or XPS installed, this may be the culprit. In both cases, by performing an uninstall on this add-in via the Control Panel, and then installing Expression Web, everything works okay. You can even re-install the Office 2007 add-in when you're done.

    I can't find a knowledge base article on this issue, so I can't be 100% sure that it will solve the problem in all cases, but so far, I'm two for two. Please leave feedback if this helps your situation.

  • Mike Swanson's Blog

    SWF2XAML: A Tool to Convert Flash Files to XAML


    Finally! After months of tinkering around in my spare time, I've managed to assemble a relatively useful tool called SWF2XAML. The first version of this tool allows you to open a Flash/SWF file and advance through the frames one-by-one. When you've found a frame that you like, you can easily export it to a file or copy its XAML to the clipboard. Import or paste the XAML into your tool of choice, and off you go.

    Now, before you start converting files, let me set your expectations. Flash files contain a lot of information, including shape definitions, animations, and code in the form of ActionScript. The version of SWF2XAML I'm releasing today only converts shapes on a frame-by-frame basis. In other words, there is no conversion to native WPF animations, and there is certainly no code conversion. Both of these are possible, and they'd require a lot more work.

    If you'd like to know more about the technical details, Karsten Januszewski, a fellow Technical Evangelist, filmed a short Channel 9 interview that provides insight into the structure of a SWF file, what is currently converted, and the general algorithm used to bring shapes into WPF. Plus, there is a very quick walkthough and demo at the beginning of the video.

    I've written two blog posts about some of my earlier experimentation: Converting Flash Shapes to WPF, and Example C# Code for Reading Flash (SWF) Files. If you plan to write your own utility, these should be very useful.

    I'd love your feedback! Is this tool useful? What other features would you like to see supported? Would anyone really want to convert ActionScript to something like C#?

    Update: I just posted a 11½ minute screencast that gives a quick walk-through of the tool. 

Page 5 of 74 (369 items) «34567»