검색결과 리스트
Python에 해당되는 글 2건
- 2016.12.03 Fast screen capture in python. 2016년 10월 5일 수요일
- 2016.12.03 Using GPIO in Raspberry pi 2016년 9월 21일 수요일
글
Fast screen capture in python. 2016년 10월 5일 수요일
I need to screen capture to make simple macro program.
First, I use ImageGrab in pillow or pyscreenshot.
But, These are too slow for my program.
Then, I found good library-wx.
wx is GUI development library based on C++.
Capture method in wx is more faster than ImageGrab.
But, on pixel processing using pillow methods, PNG is on error.
I don't know why it is, BMP is ok.
Sample code in python.
import time
import pyscreenshot as ImageGrab
import wx
from PIL import Image
def main():
count = 10
start = time.time()
for i in xrange(count):
im = ImageGrab.grab(bbox=(0, 0, 100, 100))
im.save('ImageGrab.png')
print time.time() - start
start = time.time()
app = wx.App()
screen = wx.ScreenDC()
for i in xrange(count):
bmp = wx.EmptyBitmap(100, 100)
mem = wx.MemoryDC(bmp)
mem.Blit(0, 0, 100, 100, screen, 0, 0)
del mem
bmp.SaveFile('wx.bmp', wx.BITMAP_TYPE_BMP)
print time.time() - start
if __name__ == '__main__':
main()
Get 0,0 to 100,100 screen image and save it 10 times.
Execute results.
17.631000042
0.203000068665
In my computer, wx is faster than pyscreenshot about 80 times.
If you need to fast screen capture, use wx.
wx install url:
https://wxpython.org/download.php
'프로그래밍 > english' 카테고리의 다른 글
Use of vim 2016년 9월 21일 수요일 (0) | 2016.12.03 |
---|---|
Using GPIO in Raspberry pi 2016년 9월 21일 수요일 (0) | 2016.12.03 |
글
Using GPIO in Raspberry pi 2016년 9월 21일 수요일
GPIO(General Purpose Input Output)
You can process various data from sensor.
(Fire sensor, Temperature sensor...)
'프로그래밍 > english' 카테고리의 다른 글
Fast screen capture in python. 2016년 10월 5일 수요일 (0) | 2016.12.03 |
---|---|
Use of vim 2016년 9월 21일 수요일 (0) | 2016.12.03 |