ScreenCapturer 3.0.1

dotnet add package ScreenCapturer --version 3.0.1                
NuGet\Install-Package ScreenCapturer -Version 3.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ScreenCapturer" Version="3.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ScreenCapturer --version 3.0.1                
#r "nuget: ScreenCapturer, 3.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ScreenCapturer as a Cake Addin
#addin nuget:?package=ScreenCapturer&version=3.0.1

// Install ScreenCapturer as a Cake Tool
#tool nuget:?package=ScreenCapturer&version=3.0.1                

ScreenCapturer

Library for easy screen capture based on SharpDX package. Available as NuGet package.

Compatible with .NET Standard 2.0 and higher.

Usage

All methods, events and properties can be accessed using static ScreenCapturer class.

Methods

StartCapture — starts capture and callback threads.

StopCapturing — asynchronously stops capture and callback threads.

Events

OnScreenUpdated — dispatched when screen snapshot was made, additional info in notes.

OnCaptureStop — dispatched when capture is stopped manually or because of exception.

Flags and options

SkipFirstFrame — if flag is set to true (default) then first captured screen snapshot gets skipped and no callbacks called (for some unknown reason it is a black screen, apparently SharpDX related issue).

SkipFrames — if flag is set to true (default) and snapshot queue size gets over than 2 bitmaps then oldest bitmaps get removed.

PreserveBitmap — if flag is set to false (default) then after callbacks were executed bitmap gets disposed automatically.

IsActive — read-only property that indicates that capture is active (it can be starting, in progress or going to be stopped).

IsNotActive — read-only property that indicated that capture is not active (opposite to IsActive).

Usage examples

Minimal:

using System.Drawing;
using ScreenCapturerNS;

ScreenCapturer.StartCapture((Bitmap bitmap) => {
    // Process image (bitmap) here
});

Typical C# events way:

using System.Drawing;
using ScreenCapturerNS;

void OnScreenUpdated(Object? sender, OnScreenUpdatedEventArgs e) {
    // Process image (e.Bitmap) here
}

ScreenCapturer.OnScreenUpdated += OnScreenUpdated;
ScreenCapturer.StartCapture();

Notes

You can set callback by passing action as argument to StartCapture or set it as standard event callback using OnScreenUpdated. StopCapturing will stop capture as fast as possible, however method will return immediately to minimize deadlock possibility.

Use OnCaptureStop event if you need to perform actions after capture was really stopped. If capture process gets interrupted by exception (SharpDX exception in capture thread or exception in any of capture callbacks in callback thread) and OnCaptureStop event has assigned callback — it will be called with exception as argument (might be useful if resolution gets changed and etc.), otherwise regular exception will be thrown.

Possible issues

If capture gets often interrupted by SharpDX exceptions small memory leaks may occur, though it's should be unnoticable in most cases and can be ignored.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.1 3,867 2/23/2023
3.0.0 1,678 10/21/2021
2.0.0 1,097 8/9/2020
1.0.4 5,205 4/25/2020
1.0.3 913 10/6/2019
1.0.2 532 9/19/2019
1.0.1 491 9/19/2019
1.0.0 569 9/19/2019