asweigart / pyscreeze

PyScreeze is a simple, cross-platform screenshot module for Python 2 and 3.
BSD 3-Clause "New" or "Revised" License
193 stars 96 forks source link

pyscreeze.screenshot makes a full desktop screenshot instead of region #104

Closed mutiev closed 1 year ago

mutiev commented 1 year ago

I'm taking a screenshot of region but instead I have full desktop screenshot

import pyscreeze
import cv2
import numpy as np
import os
import pathlib

os.chdir(pathlib.Path(__file__).parent.resolve())
screenshot = pyscreeze.screenshot(region=(0,0, 50,50))
screenshot = cv2.cvtColor(np.array(screenshot), cv2.COLOR_RGB2BGR)
cv2.imwrite('captured-screen.png', screenshot)

my hardware setup: macmini m2, one monitor

image

adonishong commented 1 year ago

same issue met here, macOS with M2 Max, Ventura 13.4.1 python environment is managed with anaconda, python 3.10, pyscreeze 0.1.29

b4 a fix release, here is an work around // img = pyautogui.screenshot(region=(x, y, w, h)) full_desk_img = pyautogui.screenshot() img = full_desk_img.crop((x, y, x + w, y + h))

asweigart commented 1 year ago

This fix is going into 1.0.0. Thanks!

samik3301 commented 1 year ago

This fix is going into 1.0.0. Thanks!

I was actually looking forward to make this as my first successful PR getting merged and an open source contribution but anyways, thanks for acknowledging and including it in the new version. Happy to help! :)