PIL ImageGrab captures wrong resolution

I am trying to get full screen (1920 x 1080) using this code. The saved images are only 1536 x 864, though.

Decision. As Mark noted, Windows has scaling, which can be changed using the control panel> Display (completely disable it).

from PIL import ImageGrab import os import time def screenGrab(): # snapshot of screen im = ImageGrab.grab() # saves in current work directory with name based on time of pic im.save(os.getcwd() + '\\full_snap__' + str(int(time.time())) + '.png', 'PNG') def main(): screenGrab() if __name__ == '__main__': main() 
+6
source share
1 answer

If your display settings are set to a value other than the default β€œsmaller” (100%), Windows will tell your applications to display them in a smaller area, and then increase the results as they put it on the desktop table. Obviously, the PIL has an error caused by this parameter, the capture is cropped to a smaller size, not a full desktop. The workaround is to make sure your display settings are set to 100%.

+3
source

Source: https://habr.com/ru/post/974255/


All Articles