Taking Screen shots of specific size

后端 未结 5 462
庸人自扰
庸人自扰 2021-01-03 03:26

What imaging modules for python will allow you to take a specific size screenshot (not whole screen)? I have tried PIL, but can\'t seem to make ImageGrab.grab() select a sma

5条回答
  •  梦谈多话
    2021-01-03 04:20

    You can use pyscreenshot at linux or windows platforms . I am using Ubuntu it works for me. You can force if subprocess is applied setting it to false together with mss gives the best performance.

    import pyscreenshot as ImageGrab
    import time
    t1 = time.time()
    imgScreen = ImageGrab.grab(backend="mss", childprocess=False)
    img = imgScreen.resize((640,480))
    img.save("screen.png")
    t2 = time.time()
    print("The passing time",(t2-t1))
    
    

提交回复
热议问题