News

Visual Studio Tool Lets Devs See Images, Not Just Text Strings

Microsoft's Mads Kristensen has a point: Developers working with images in Visual Studio must deal only with text strings that don't show the actual images.

"Any web, desktop, or mobile developer works with images often. You reference them from C#, HTML, XAML, CSS, C++, TypeScript, and even in code comments," he said in an Aug. 28 post. "Some images are local, and some exist online or on network shares, while others only exist as base64 encoded strings. We refer to them in numerous ways in code, but always as string values that don't show us what the image looks like. It would be nice if those image references could show us the images too."

To that end, the extension guru has whipped up another offering to add to his long list: Image Preview.

Once again, Kristensen's innovation comes in response to developer feedback provided on Microsoft's Developer Community site, where a July 20 post asked for "An option to preview images when they are hovered."

And, even though one commenter said, "This feature could be helpful, but to be real I don't think Microsoft would ever consider it," that's exactly what the tool does, working with GIF, PNG, JPG, ICO and SVG image formats.

Finally, as depicted below, a developer can actually see what that "icon2.png" looks like, not to mention Mads himself.

[Click on image for larger, animated GIF view.] Image Preview in Animated Action (source: Microsoft).

While the idea has been kicked around and realized in various implementations, Kristensen noted they work in different ways. While many image preview tools are available for Visual Studio Code, not so much for the IDE.

"If we were to build this, we must do it in a way that feels native and natural to Visual Studio," he said. "To do that, we're launching an experiment to figure out what that could look like."

The tool tip enacted by hovering over an image works for the following types of string representations, or image reference syntaxes:

  • Absolute URL (http, https, and ftp)
  • Relative URL (./, ../, and /)
  • File path (c:\, c:/, \, and /)
  • Data URI (data:image/png;base64,…)
  • Pack URI (pack://application:,,,/Images/MyImage.png)

Kristensen's creations have a way of eventually appearing as built-in bits in the IDE, and developers can weigh in on this one by opening issues on the GitHub issue tracker or sending pull requests to the GitHub project. The latter seems to be a preference: "Pull requests are also very welcome, since I can't always get around to fixing all bugs myself. This is a personal passion project, so my time is limited." Images seem to be a specialty of Kristensen, as a few of his other of his tools in the marketplace include Image Optimizer, Image Sprites and Image Manifest Tools.

As of this writing, the Image Preview tool in the Visual Studio Marketplace has been installed 61 times, earning a perfect 5.0 rating from two developers who reviewed it.

As noted above, early feedback has been registered on the Developer Community post, where one developer suggested on Aug. 9 that the functionality be available as an extension, since not that many developers were likely to need it.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Hands On: New VS Code Insiders Build Creates Web Page from Image in Seconds

    New Vision support with GitHub Copilot in the latest Visual Studio Code Insiders build takes a user-supplied mockup image and creates a web page from it in seconds, handling all the HTML and CSS.

  • Naive Bayes Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the naive Bayes regression technique, where the goal is to predict a single numeric value. Compared to other machine learning regression techniques, naive Bayes regression is usually less accurate, but is simple, easy to implement and customize, works on both large and small datasets, is highly interpretable, and doesn't require tuning any hyperparameters.

  • VS Code Copilot Previews New GPT-4o AI Code Completion Model

    The 4o upgrade includes additional training on more than 275,000 high-quality public repositories in over 30 popular programming languages, said Microsoft-owned GitHub, which created the original "AI pair programmer" years ago.

  • Microsoft's Rust Embrace Continues with Azure SDK Beta

    "Rust's strong type system and ownership model help prevent common programming errors such as null pointer dereferencing and buffer overflows, leading to more secure and stable code."

  • Xcode IDE from Microsoft Archrival Apple Gets Copilot AI

    Just after expanding the reach of its Copilot AI coding assistant to the open-source Eclipse IDE, Microsoft showcased how it's going even further, providing details about a preview version for the Xcode IDE from archrival Apple.

Subscribe on YouTube

Upcoming Training Events