Show / Hide Table of Contents

Class CaptureScreenImage

Captures image pixels from screen or window.

public sealed class CaptureScreenImage : IDisposable
Remarks

This class is used by CaptureScreen, uiimage and uiimageFinder. Also you can use it directly. For example it can get pixels directly without copying to a Bitmap or array.

How to use:

  1. Create variable.
  2. Call Capture.
  3. Call other functions to get result in various formats.
  4. If need, repeat 2-3 (for example when waiting for image).
  5. Dispose (important).

Pixel format: Format32bppArgb, alpha 0xff.

Examples
var w = wnd.find("LibreAutomate").Child("document");

using var c = new CaptureScreenImage();
if (!c.Capture(w, new(0, 0, 200, 200))) return;
using var b = c.ToBitmap();

var f = folders.Temp + "test.png"; b.Save(f); run.it(f);

Namespace: Au.More
Assembly: Au.dll
Inheritance
object
CaptureScreenImage

Properties

Name Description
Height

Height of the captured image.

Pixels

Pixels of the captured image.

Width

Width of the captured image.

Methods

Name Description
Capture(RECT, bool)

Captures image from screen into memory stored in this variable.

Capture(wnd, RECT?, CIFlags)

Captures image from window client area into memory stored in this variable.

Dispose()

Frees image memory.

ToArray1D()

Copies pixels of the captured image to new 1D array.

ToArray2D()

Copies pixels of the captured image to new 2D array [row, column].

ToBitmap()

Creates new Bitmap from pixels of the captured image.