Saving bitmap to file using Rhinocommon

I’ve seen ways to create a bitmap file, such as the answers to this thread:

But I can’t seem to find the direct command to save that bitmap file to a specified folder in my computer. What commands would I use to accomplish my task?

BitMap bm = view.CaptureToBitmap(new Size(600,800));
1 Like

I tried that, but this seems to be a persistent error:

“A generic error occurred in GDI

My code (“Output” is a a custom class):

Rhino.Display.RhinoView View = doc.Views.ActiveView;
var bitmap = View.CaptureToBitmap(new Size(480, 480));
bitmap.Save(@“C:\test” + current + “.jpeg”, ImageFormat.Jpeg);
catch (Exception e)

I also tried:

Rhino.Display.RhinoView View = doc.Views.Add(“Snapshot” +
current, Rhino.Display.DefinedViewportProjection.Perspective, new Rectangle(
0, 0, 480, 480), false);

What can I do to fix this error?

Do you have write access on the file c:\testcurrent.jpg?
You are trying to write to the c: root folder,

Yes that was the problem! I couldn’t directly add any files to the root
folder without my admin password. Thanks!