How to look at Bitmap objects in Visual Studio debugger?

孤人 提交于 2021-02-18 19:50:01

问题


I am building a C# app that creates many bitmaps (System.Drawing.Image). Having the bitmaps seen in the debugger as pictures, would be of enormous help. The debugger has native support for XML files. Is there a way to see the pictures?


回答1:


There is no debugger visualizer by default for Bitmap, so you might want to give this one a try: http://imagedebugvisualizer.codeplex.com/




回答2:


Another open source image and bitmap visualizer which works in Visual Studio 2019:

https://github.com/Jaex/ImageVisualizer

Screenshot from it:




回答3:


I did it this way before I read Rachel's comment above which would have been much easier....

You could Base64 encode it - in your immediate Window:

System.IO.MemoryStream stream = new System.IO.MemoryStream();
yourImage.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
byte[] bytes = stream.ToArray();
base64string = System.Convert.ToBase64String(bytes);

Then copy and paste the value of base64string into your favourite base64 debugger, e.g.

https://codebeautify.org/base64-to-image-converter




回答4:


This program works for me in 2013 and should work from 2010 - 15 http://bytescout.com/products/developer/bitmapvisualizer/index.html




回答5:


Try BitMapVisualizer by ByteScout http://bytescout.com/products/developer/bitmapvisualizer/index.html

Trial version is for free




回答6:


Another good option is Bitmap & BitmapSource Visualizer for Visual Studio 2013. It also has bonus as source code (I used it for recompiling into 4.5 framework due to problems with 3.5 in my machine).

By default it adds Width and Height information about image (in contrast of Bytescout plugin, which adds more info), but you can add any information through code - there just simple String.Format using.



来源:https://stackoverflow.com/questions/10246831/how-to-look-at-bitmap-objects-in-visual-studio-debugger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!