0

I need fast to get the image from a game. And i try with simple screen shots like this:

        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("Screen.bmp");
        }  

but i don't know why if i get the screen shot i can get another after 10 sec... need a way to take faster images. It would be even better to take the game frames.

TreantBG
  • 1,192
  • 6
  • 25
  • 44

3 Answers3

1

I would consider threading this off.

Saving the bitmaps in memory and on a seperate thread as items go to your BitMap Stack you can just pop them off one at a time and save to disk.

This way you can keep taking as many screenshots as you want

ist_lion
  • 3,149
  • 9
  • 43
  • 73
0

Avoid this line

using(Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))

on every call to save screen shot. Just initialize it once as a global variable and see the magic.

Raging Bull
  • 18,593
  • 13
  • 50
  • 55
sundar
  • 1
0

If you want to grab more than one screenshot, you might need to consider a "frameCounter" and add it up per cycle.

Arian
  • 73
  • 12