I am using
string SnapPath = "Users/dreamztechsmacmini5/Desktop/Partha/NewApplication/enableEmployment/Snapshot" + "/" + taskId; if (!System.IO.Directory.Exists(SnapPath)) System.IO.Directory.CreateDirectory(SnapPath);
int width = 1200;
int height = 1200;
int windowNumber = 0; System.Drawing.RectangleF bounds = new RectangleF(0,0,1200,1200);
CGImage screenImage = MonoMac.CoreGraphics.CGImage.ScreenImage(windowNumber,bounds);
using(NSBitmapImageRep imageRep = new NSBitmapImageRep(screenImage))
{
NSDictionary properties = NSDictionary.FromObjectAndKey(new NSNumber(1.0), new NSString("NSImageCompressionFactor"));
using(NSData tiffData = imageRep.RepresentationUsingTypeProperties(NSBitmapImageFileType.Png, properties))
{
//NSError err=new NSError();
//tiffData.Save(System.IO.Path.Combine(SnapPath, Guid.NewGuid().ToString() + ".png"),false,out err);
byte[] imageBytes;
using(var ms = new MemoryStream())
{
tiffData.AsStream().CopyTo(ms);
imageBytes = ms.ToArray();
Bitmap img = (Bitmap)System.Drawing.Image.FromStream(ms);
img.Save(System.IO.Path.Combine(SnapPath, Guid.NewGuid().ToString() + ".png"));
}
}
}
but it creates blank images. Please help me.