![]() |
VOOZH | about |
dotnet add package PublicUtility.ScreenReader --version 1.0.0
NuGet\Install-Package PublicUtility.ScreenReader -Version 1.0.0
<PackageReference Include="PublicUtility.ScreenReader" Version="1.0.0" />
<PackageVersion Include="PublicUtility.ScreenReader" Version="1.0.0" />Directory.Packages.props
<PackageReference Include="PublicUtility.ScreenReader" />Project file
paket add PublicUtility.ScreenReader --version 1.0.0
#r "nuget: PublicUtility.ScreenReader, 1.0.0"
#:package PublicUtility.ScreenReader@1.0.0
#addin nuget:?package=PublicUtility.ScreenReader&version=1.0.0Install as a Cake Addin
#tool nuget:?package=PublicUtility.ScreenReader&version=1.0.0Install as a Cake Tool
The advanced screen reader allows the user to take a general screenshot of the main screen and locate small or large image snippets using AI for reading. Available for Linux and Windows.
this method allows the user to identify the size of the current screen, that is, point X and point Y at their maximum, which we translate to W (Width) and H (Height) respectively.
Example:
using PublicUtility.ScreenReader;
using PublicUtility.Nms.Structs;
// Simplified with "var"
var size1 = ScreenManager.GetScreenSize(); // returns a ScreenSize struct
Console.WriteLine(size1);
// Complete version
ScreenSize size2 = ScreenManager.GetScreenSize(); // returns a ScreenSize struct
Console.WriteLine(size2);
printscreen is a simple command capable of capturing the current screen in use. Its return is an Image of type "SixLabors.ImageSharp.Image" and can be converted to different types according to the user's preference. Example
using PublicUtility.ScreenReader;
using PublicUtility.Nms.Structs;
using SixLabors.ImageSharp;
// Example 1
var screenshotFull = ScreenManager.PrintScreen(); // get a printscreen in fullsize
screenshotFull.SaveAsPng(@"C:\Temp\fullScreenshot.png");
// Example 2
var initBox = new PointIntoScreen(X: 50, Y: 50); // x and y coordinates
var boxSize = new ScreenSize(Width: 200, Height: 200); // a box of 200 pixels X 200 pixels is formed
var box = new BoxOfScreen(boxSize, initBox);
var screenshotBox = ScreenManager.PrintScreen(box); // takes a screenshot starting from point X = 50 and point Y = 50 with a height of 200 pixels and a width of 200 pixels.
screenshotBox.SaveAsPng(@"C:\Temp\customScreenshot.png");
// Example 3 - Simplified
var screenshotBox2 = ScreenManager.PrintScreen(new(new(400, 400), new(100, 100))); // takes a screenshot starting from point X = 100 and point Y = 100 with a height of 400 pixels and a width of 400 pixels.
screenshotBox2.SaveAsPng(@"C:\Temp\customScreenshotSimplified.png");
this method is used to locate parts of images or colors on the user's main screen and has some ways to use it, see below.
It will search the screen until it finds a pixel that contains the desired color, if not, its return will be an empty coordinate point that indicates the non-location of the color on the screen
Example for Windows only
using PublicUtility.ScreenReader;
using PublicUtility.Nms.Structs;
var color = new PixelColor(Alpha: 0, Red: 255, Green: 0, Blue: 0);
var loc = ScreenManager.LocateOnScreen(color);
Console.WriteLine(loc);
In this case, a search will be performed using an image fragment as a reference. If this image fragment used as a reference is on the screen, the function's return will be a Filled box that can be checked through the "Filled" read-only attribute that returns boolean for filled or not filled.
Example
using PublicUtility.ScreenReader;
const string pathWindowsIco = @"C:\Temp\winIco.png";
var box = ScreenManager.LocateOnScreen(pathWindowsIco);
if(box.Filled)
Console.WriteLine($"FILLED!");
else
Console.WriteLine($"NOT FILLED!");
unlike LocateOnScreen, LocateAll returns all items located on the screen that have a shape within the standards and that are the same or similar to the image fragment provided in the search parameter.
Example
using PublicUtility.ScreenReader;
const string pathWindowsIco = @"C:\Temp\winIco.png";
var listBox = ScreenManager.LocateAllOnScreen(pathWindowsIco);
foreach(var box in listBox)
Console.WriteLine(box);
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 472 | 11/1/2022 |