Sunday, December 19, 2010

Create an automated screenshot


Original Link: http://www.grasshopper3d.com/forum/topics/having-grasshopper-create-an

Rectangle bounds = Screen.GetBounds(System.Drawing.Point.Empty);
using(Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))

{

    using(Graphics g = Graphics.FromImage((Image) bitmap))

    {

        g.CopyFromScreen(System.Drawing.Point.Empty, System.Drawing.Point.Empty, bounds.Size);

    }

    bitmap.Save(@"C:\SomePath\SomeFilename.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

}

No comments:

Post a Comment