ImageHelper

Screen Capture

CaptureScreen takes a screenshot of the current screen or visible browser tab. Pass a browser or application object to capture a specific window, or call with no arguments to capture the full desktop. SaveToFile saves the captured screenshot to the specified GPALFile path - overwrites if the file exists. ToBase64String converts the last captured screenshot to a Base64 JPEG string. ToBitmap returns the screenshot as a System.Drawing.Bitmap. ToGPALObject returns the IImageHelper interface.

Examples

GPAL Fluent: High-level fluent C# API

//CaptureScreen works in both headful (visible window) and headless modes. In headless mode with a browser reference, it captures the browser tab content. ToBase64String produces a JPEG-encoded Base64 string.

// Capture the full desktop

GPAL.Image

.CaptureScreen()

.SaveToFile("C:\screenshots\desktop.png");


// Capture a specific browser tab

GPAL.Image

.CaptureScreen(myBrowser)

.SaveToFile("C:\screenshots\browser.png");


// Capture and convert to Base64 for embedding

string base64;

GPAL.Image

.CaptureScreen()

.ToBase64String(out base64);

💬 Ask GPAL