How to export a quick image with viewport frame from opened document using C#

Hey guys,

I have a C# program that needs to be able to automatically to an “Export a quick image” with “viewport frame” from the currently opened document.

Do you have some API commands that allow me to do that?

IF not, do you have some suggestions?
Should I use some of those libraries that allow me to automatically press the buttons within the tools?

_WinWaitActivate(“Grasshopper - Test”,"")
_WinWaitActivate(“Quick Image Editor”,"")
_WinWaitActivate(“Grasshopper Canvas Image”,"")

find attached C# (5.1 KB)

Thanks Nicholas, I have a grasshopper plugin, in which this code cannot be used?

I am using the
using Rhino;
using Rhino.Display;

Any ideas if in these or similar we can achieve this Export a quick image with the viewport frame?=