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

  • Creating Business Applications Using Blazor

    Expert Blazor programmer Michael Washington' will present an upcoming developer education session on building high-performance business applications using Blazor, focusing on core concepts, integration with .NET, and best practices for development.

  • GitHub Celebrates Microsoft's 50th by 'Vibe Coding with Copilot'

    GitHub chose Microsoft's 50th anniversary to highlight a bevy of Copilot enhancements that further the practice of "vibe coding," where AI does all the drudgery according to human supervision.

  • AI Coding Assistants Encroach on Copilot's Special GitHub Relationship

    Microsoft had a great thing going when it had GitHub Copilot all to itself in Visual Studio and Visual Studio Code thanks to its ownership of GitHub, but that's eroding.

  • VS Code v1.99 Is All About Copilot Chat AI, Including Agent Mode

    Agent Mode provides an autonomous editing experience where Copilot plans and executes tasks to fulfill requests. It determines relevant files, applies code changes, suggests terminal commands, and iterates to resolve issues, all while keeping users in control to review and confirm actions.

  • Windows Community Toolkit v8.2 Adds Native AOT Support

    Microsoft shipped Windows Community Toolkit v8.2, an incremental update to the open-source collection of helper functions and other resources designed to simplify the development of Windows applications. The main new feature is support for native ahead-of-time (AOT) compilation.

Subscribe on YouTube