Image Insertion – Extension #2

Speaks a thousand words with images!

The image insertion tool allows you to drag and drop images directly into your code, as shown below with an image of a UML diagram. Or, you could include your UI mockups to live literally alongside your code.

UML diagram inserted in code

But the real reason I am including this extension is to prove to you this is an entirely new editor. In the image below, I’ve inserted a stick figure karate fighter (written in Silverlight) doing a side snap kick directly above the “Throw Kick” button click event handler.

Throwing a side kick within visual studio editor

Now as I zoom in (shown below at 200%), notice how both the text and the stick figure image both increase at the same ratio.


The first time I saw this demo, I said “wow”. It blew my mind seeing someone drag an image directly into a code editor, and not into some special designer just for this purpose.

To Install

Please see my post How To Install Visual Studio Extensions. The extension name is “Image Insertion.”

To Use

You just drag and drop images onto the Editor surface, either from the Solution Explorer or from outside Visual Studio. Note that in order to get the image into the Editor, you must see the blue placeholder line, as shown below. VS will insert the image directly above this blue line.

The blue line for the image

To remove the inserted image, you need to click the ‘x’ button in the upper right corner. The UI here is a little sensitive, so you need to move the mouse really slowly towards the ‘x’ button so it doesn’t disappear on you. (And yes, you can use the arrows to resize the image.)


To Customize

Although this extension doesn’t come with any options to configure, the source code is available for you to play with at


Comments (8)

  1. Martin says:

    This is  really cool. Literate programming is one step closer.

  2. Jens Samson says:

    This is something I’ve been wanting for years.  Hope it’s not C# only or I’m going to be pissed…

  3. tob says:

    thats cool.

    but is it possible to make the image transparent – behind the code?

    i think about giving one or more methods a background image. similar to the image above while you drag the image on the code with the blue line.

  4. saraford says:

    @Jens Don’t worry, you’re not going to be pissed. It should work for all editors. I’ve tested it in VB and C#.

    @tob that’s an interesting idea. You should add the suggestion to the Visual Studio Gallery page where the extension is hosted.

    @Martin =D

  5. jamprice59 says:

    this is great. thanks for posting

  6. Alex McKenzie says:

    How/where is the image saved? Is it a separate entry under the project, stored in the source file as a base-64 comment, or something else altogether?

    What will the rest of my team see if I use this and they don’t install the extension?

  7. saraford says:

    @alex my bad, i thought i had mentioned that. the image is saved in a separate .resx file. If you do not have the extension installed, you won’t see a file. The .resx file is ignored. (you can try this yourself by uninstalling the extension and seeing what happens). It would be up to you whether you want to check this file in.

  8. Alex McKenzie says:

    @saraford That’s what I was hoping to hear. Thank you.