Skip to content

Instantly share code, notes, and snippets.

@jacob-faber
Last active April 10, 2017 18:56
Show Gist options
  • Save jacob-faber/73492f8cdd9ccec73f6ea73f47d270b0 to your computer and use it in GitHub Desktop.
Save jacob-faber/73492f8cdd9ccec73f6ea73f47d270b0 to your computer and use it in GitHub Desktop.
Wx
import time
import pyscreenshot as ImageGrab
import wx
def main():
count = 10
area = (0, 0, 1920, 1080)
start = time.time()
for _ in range(count):
im = ImageGrab.grab(bbox=area, backend='imagemagick')
#im.save('ImageGrab.png')
print('ImageGrab - imagemagic backend', time.time() - start)
start = time.time()
app = wx.App()
screen = wx.ScreenDC()
for _ in range(count):
bmp = wx.Bitmap(1920, 1080)
mem = wx.MemoryDC(bmp)
mem.Blit(*area, screen, 0, 0)
del mem
#bmp.SaveFile('wx.png', wx.BITMAP_TYPE_PNG)
print('WX', time.time() - start)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment