I'm developing a cross-platform desktop application using Avalonia, in which I want to take screenshots of the desktop after every 5 min. By googling I get the code to take screenshot in windows OS.
Rectangle bounds = Screen.GetBounds(Point.Empty);
using(Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using(Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
}
bitmap.Save("test.jpg", ImageFormat.Jpeg);
}
But how can I do it in Linux and Mac OS. Anyone please help me.