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?
There is no debugger visualizer by default for Bitmap, so you might want to give this one a try: http://imagedebugvisualizer.codeplex.com/
Another open source image and bitmap visualizer which works in Visual Studio 2019:
https://github.com/Jaex/ImageVisualizer
Screenshot from it:
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.
This program works for me in 2013 and should work from 2010 - 15 http://bytescout.com/products/developer/bitmapvisualizer/index.html
Try BitMapVisualizer by ByteScout http://bytescout.com/products/developer/bitmapvisualizer/index.html
Trial version is for free
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.
The answers are good but yet another alternative is to write your own debugger visualizer, which is supported by VS for a long time. There is a good old CodeProject article showing how to write a debugger visualizer:
https://www.codeproject.com/Articles/24211/Graphics-Debugger-Visualizer
Using this method I had also written other visualizers before such as DataTable visualizer. Not just for Bitmap visualizer, this is up to your custom needs and you can write any visualizer.
The process is pretty easy: Write your visualizer, compile it as a DLL and drop it into your VS\Common7\Packages\Debugger\Visualizers folder.
06.2024 update
Image Watch for Visual Studio 2022 by Microsoft Can be found directly under Extensions in VS 2022
© 2022 - 2024 — McMap. All rights reserved.
bitmap.Save(@"C:\test.bmp")
from the Immediate Window to view my bitmaps when debugging, although I know this isn't ideal when debugging a large number of bitmaps :) – Strother