Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: in method [_screenshot_xxx ], causing larger screenshots #114

Open
wants to merge 1 commit into
base: dependabot/pip/certifi-2023.7.22
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pyscreeze/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def _screenshot_win32(imageFilename=None, region=None):
if region is not None:
assert len(region) == 4, 'region argument must be a tuple of four ints'
region = [int(x) for x in region]
im = im.crop((region[0], region[1], region[2] + region[0], region[3] + region[1]))
im = im.crop((region[0], region[1], region[2], region[3]))
if imageFilename is not None:
im.save(imageFilename)
return im
Expand All @@ -563,7 +563,7 @@ def _screenshot_osx(imageFilename=None, region=None):
if region is not None:
assert len(region) == 4, 'region argument must be a tuple of four ints'
region = [int(x) for x in region]
im = im.crop((region[0], region[1], region[2] + region[0], region[3] + region[1]))
im = im.crop((region[0], region[1], region[2], region[3]))
os.unlink(tmpFilename) # delete image of entire screen to save cropped version
im.save(tmpFilename)
else:
Expand Down Expand Up @@ -607,7 +607,7 @@ def _screenshot_linux(imageFilename=None, region=None):
# Return just a region of the screenshot.
assert len(region) == 4, 'region argument must be a tuple of four ints' # TODO fix this
region = [int(x) for x in region]
im = im.crop((region[0], region[1], region[2] + region[0], region[3] + region[1]))
im = im.crop((region[0], region[1], region[2], region[3]))
return im
elif RUNNING_X11 and SCROT_EXISTS: # scrot only runs on X11, not on Wayland.
# Even if gnome-screenshot exists, use scrot on X11 because gnome-screenshot
Expand All @@ -629,7 +629,7 @@ def _screenshot_linux(imageFilename=None, region=None):
if region is not None:
assert len(region) == 4, 'region argument must be a tuple of four ints'
region = [int(x) for x in region]
im = im.crop((region[0], region[1], region[2] + region[0], region[3] + region[1]))
im = im.crop((region[0], region[1], region[2], region[3]))
os.unlink(tmpFilename) # delete image of entire screen to save cropped version
im.save(tmpFilename)
else:
Expand Down