An extensible screen capture library written in C# using native APIs.
The system is split in multiple packages. To install the main package you can use:
PM> Install Emphasis.ScreenCaptureFor exporting the screen capture as System.Drawing.Bitmap you can install:
PM> Install Emphasis.ScreenCapture.Runtime.Windows.DXGI.BitmapAnd here is a code example how to get a screen capture:
varmanager=newScreenCaptureManager();varscreen=manager.GetScreens().FirstOrDefault();usingvarcapture=awaitmanager.Capture(screen);usingvarbitmap=awaitcapture.ToBitmap();bitmap.Save("capture.png");varinfo=newProcessStartInfo("capture.png"){UseShellExecute=true};Process.Start(info);The DXGI API requires that each frame is released before acquiring the next. Therefore make sure to dispose each IScreenCapture instance before capturing the next one.
To test screen capture run in the git folder:
dotnettest"src/Emphasis.ScreenCapture.sln"--filter Name~Capture_Bitmap