{"id":1903,"date":"2010-06-27T16:00:00","date_gmt":"2010-06-27T16:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2010\/06\/27\/15-minute-blog-post-png-files-in-packages\/"},"modified":"2022-10-12T15:17:35","modified_gmt":"2022-10-12T22:17:35","slug":"15-minute-blog-post-png-files-in-packages","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/15-minute-blog-post-png-files-in-packages\/","title":{"rendered":"15 minute blog post: PNG files in Packages"},"content":{"rendered":"<p>Recently I\u2019ve been helping plan the next version of Visual Studio. It\u2019s way too early to be talking about specifics, but one topic came up this week that I have to share.<\/p>\n<h3><\/h3>\n<h3>Package Authoring<\/h3>\n<p>As some of you may have noticed, many of the regular posters here have been busy writing extensions for the <a href=\"http:\/\/visualstudiogallery.msdn.microsoft.com\">Visual Studio Gallery<\/a>, <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/document-well-2010-plus-hidden-options\/\">some<\/a> <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/announcing-collapse-selection-in-solution-explorer-extension\/\">of<\/a> <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/changing-visual-studios-color-palette\/\">which<\/a> have <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/visual-studio-2010-background-flickering-and-customization\/\">been<\/a> featured on this blog. You too can create extensions for Visual Studio 2010 using the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb286983.aspx\">Visual Studio SDK<\/a>. If you\u2019ve ever created a package with menu items (commands) using the SDK you\u2019ll notice that the default wizard-generated package contains a sample image strip that looks like this:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2018\/10\/0878.image_54B9F8B2.png\"><img decoding=\"async\" style=\"border-width: 0px;\" title=\"image\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/06\/6747.image_thumb_71DFA0BC.png\" alt=\"image\" width=\"84\" height=\"20\" border=\"0\" \/><\/a><\/p>\n<p>These are the little 16&#215;16 icons that appear on menu items and toolbar buttons. It\u2019s just placeholder artwork for various commands that you might want to implement in your new package. You\u2019re supposed to edit the image to add your own artwork. However, the image is in a strange format: It\u2019s a 32 bits per pixel image with a .BMP extension (the filename is \u201cImages_32bit.bmp\u201d). If you try and edit it in Visual Studio, you\u2019ll find that the built-in image editor doesn\u2019t understand the format. The interesting thing is that this image contains a full 8-bit alpha channel. We\u2019ve come across alpha channels before in the <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/behind-the-scenes-the-splash-screen\/\">discussion of the Splash Screen<\/a> and another area where Visual Studio supports full alpha is on menus and toolbars. Unfortunately, the .BMP file specification doesn\u2019t officially support this 32bpp ARGB format and many applications will either refuse to recognize it or will drop the alpha channel on saving.<\/p>\n<h3><\/h3>\n<h3>PNG to the rescue<\/h3>\n<p>Since this 32-bit ARGB format is so hard to work with, I suggested to the planning group that we add support for <a href=\"http:\/\/en.wikipedia.org\/wiki\/PNG\">.PNG files<\/a> to the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb491708.aspx\">VSCT compiler<\/a> (the compiler which reads your package\u2019s <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb164699.aspx\">command definitions<\/a>, including these bitmap strips, and produces binary resources). The owner of the VSCT compiler replied and said that there was no need because it already did support .PNG \u2013 in fact, it accepts any format that <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.drawing.image.fromfile.aspx\">System.Drawing.Image.FromFile<\/a> supports. Sure enough, after a quick experiment, I confirmed that is true and, indeed, MSDN already has the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb932539.aspx\">appropriate note<\/a> if you know where to look. Somehow, I had assumed that, since the wizard spat out that annoying 32-bit BMP file, that was the only file format supported and, moreover, I don\u2019t think I\u2019ve ever seen anyone use PNG files internally \u2013 and I\u2019ve seen a <em>lot<\/em> of VSCT files in my travails\/travels.<\/p>\n<h3><\/h3>\n<h3>Conclusion<\/h3>\n<p>So, there you have it. Use .PNG files for your bitmap strips. PNG has, in recent years, become the de-facto standard for images with full-transparency and lossless compression and there are many free image editing applications which support it.<\/p>\n<p>P.S. I wasn\u2019t the <a href=\"http:\/\/social.msdn.microsoft.com\/Forums\/en-US\/vsx\/thread\/6abc5145-3782-4438-8f46-a05cdb34c113\/\">first to spot this<\/a>, and, since I started writing this article and doing a little research, I found a few examples of using .PNG files in VSCT on <a href=\"http:\/\/www.bing.com\/search?q=PNG+and+VSCT+site%3Acodeplex.com&amp;form=QBLH&amp;qs=n&amp;sk=\">codeplex<\/a>. Still I think this little known fact deserves some more visibility. Perhaps in the next version of the SDK we can change the template to emit PNG files by default.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/clip_image002_2.jpg\"><em><img decoding=\"async\" style=\"margin-left: 3px; margin-right: 3px; border-width: 0px;\" title=\"clip_image002\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/06\/clip_image002_thumb.jpg\" alt=\"clip_image002\" width=\"101\" height=\"101\" align=\"left\" border=\"0\" \/><\/em><\/a><\/p>\n<p><strong>Paul Harrington<\/strong> \u2013 Principal Developer, Visual Studio Platform Team.\n<strong>Biography: <\/strong>Paul has worked on every version of Visual Studio .Net to date. Prior to joining the Visual Studio team in 2000, Paul spent six years working on mapping and trip planning software for what is today known as Bing Maps. For Visual Studio 2010, Paul was the architect for the move to WPF. Paul holds a master\u2019s degree from the University of Cambridge, England and lives with his wife and two cats in Seattle, Washington.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I\u2019ve been helping plan the next version of Visual Studio. It\u2019s way too early to be talking about specifics, but one topic came up this week that I have to share. Package Authoring As some of you may have noticed, many of the regular posters here have been busy writing extensions for the Visual [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":255385,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[294],"class_list":["post-1903","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-extensions"],"acf":[],"blog_post_summary":"<p>Recently I\u2019ve been helping plan the next version of Visual Studio. It\u2019s way too early to be talking about specifics, but one topic came up this week that I have to share. Package Authoring As some of you may have noticed, many of the regular posters here have been busy writing extensions for the Visual [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/1903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=1903"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/1903\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/255385"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=1903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=1903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=1903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}