Taking Screen shots of specific size

后端 未结 5 452
庸人自扰
庸人自扰 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:27

    1) Use pyscreenshot, ImageGrab works but only on Windows

    2) Grab the image and box it, then save that image

    3) Don't use ImageGrab.grab_to_file, it saves the full size image

    4) You don't need to show the image with im.show if you just want to save a screenshot

    import pyscreenshot as ImageGrab
    
    im=ImageGrab.grab(bbox=(10,10,500,500))
    
    im.save('im.png')
    

提交回复
热议问题