Fastest Method of Screen Capturing on Windows

Fastest way to take a screenshot with python on windows

You could use win32 APIs directly .

  1. First give the focus to the App that you want to take screenshot of.
    link text

  2. Win32 API can help with the screenshot:

import win32gui
import win32ui
import win32con

w = 1920 # set this
h = 1080 # set this
bmpfilenamename = "out.bmp" #set this

hwnd = win32gui.FindWindow(None, windowname)
wDC = win32gui.GetWindowDC(hwnd)
dcObj=win32ui.CreateDCFromHandle(wDC)
cDC=dcObj.CreateCompatibleDC()
dataBitMap = win32ui.CreateBitmap()
dataBitMap.CreateCompatibleBitmap(dcObj, w, h)
cDC.SelectObject(dataBitMap)
cDC.BitBlt((0,0),(w, h) , dcObj, (0,0), win32con.SRCCOPY)
dataBitMap.SaveBitmapFile(cDC, bmpfilenamename)

# Free Resources
dcObj.DeleteDC()
cDC.DeleteDC()
win32gui.ReleaseDC(hwnd, wDC)
win32gui.DeleteObject(dataBitMap.GetHandle())

Fastest method for screen capturing on Linux

This is possible using VirtualGL in a server with hardware acceleration. Basically just configure the server appropiately, then either on the same machine or on a machine in the same network, run

export DISPLAY=<your xvfb display>
vglrun <your_app>

This will have the following advantages:

1) your app will render using virtualGL, which will use the hardware

2) VirtualGL will display your 3D context inside the Xfvb display, which will only render the 2D widgets in CPU

3) configure Xvfb to render to a framebuffer

4) profit!

C# Which is the fastest way to take a screen shot?

This is very similar to a question asked several years ago: Here. That question was whether directx's capturing abilities could be used to get better performance.

The consensus was that it probably wouldn't provide any performance increase, TightVNC does it very quickly by cheating. It uses a driver that doesn't have to use the API that (presumably) .NET is using.

At some point I recall looking at the source code for Camstudio and I believe they use directx's capturing capabilities. I don't think you can push that much past 30 fps, and most of the time not even that. I'm not sure if that is a problem with the hooks camstudio uses to figure out when something has changed or the actual capture mechanism.



Related Topics



Leave a reply



Submit