ponty / pyscreenshot

Python screenshot library, replacement for the Pillow ImageGrab module on Linux.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pyscreenshot with twin monitors - Closed

iainrs opened this issue · comments

I am using a twin monitor system where I use the right hand screen for my main working.
Using pyscreenshot to save a tkinter canvas `

from PIL import Image,ImageTk
import pyscreenshot as ImageGrab
..
box=(x,y,x1,y1)
im = ImageGrab.grab(bbox=box)`
im.save('screenshot.png')

If the window to be captured is on the left hand screen the above code works fine.
(box value (87, 185, 1558, 993)

If it is on the right hand screen (box value (1947, 151, 1558, 993) it fails with

`Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/PIL/ImageFile.py", line 477, in _save
fh = fp.fileno()
AttributeError: '_idat' object has no attribute 'fileno'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/home/xxxx/.local/lib/python3.6/site-packages/pyscreenshot/procutil.py", line 19, in _wrapper
r = codec0
File "/home/xxxx/.local/lib/python3.6/site-packages/pyscreenshot/imcodec.py", line 22, in _coder
im.save(b, format='png')
File "/usr/lib/python3/dist-packages/PIL/Image.py", line 1935, in save
save_handler(self, fp, filename)
File "/usr/lib/python3/dist-packages/PIL/PngImagePlugin.py", line 822, in _save
[("zip", (0, 0)+im.size, 0, rawmode)])
File "/usr/lib/python3/dist-packages/PIL/ImageFile.py", line 485, in _save
e.setimage(im.im, b)
SystemError: tile cannot extend outside image`

This is not a major problem as I can always move the window before grabbing

xubuntu 18.04 system - python 3.6.7

Apologises for duplicate issue (closed by mistake)

commented

Your box is invalid: (1947, 151, 1558, 993) (x1,y1,x2,y2)

x2<x1

commented

Please report if you have success with 2 monitors (#48)