mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Do not catch OSError raised when loading image
This commit is contained in:
parent
3ec03c6720
commit
7e29efd518
|
@ -66,10 +66,6 @@ def grab(bbox=None, include_layered_windows=False, all_screens=False, xdisplay=N
|
||||||
msg = "Pillow was built without XCB support"
|
msg = "Pillow was built without XCB support"
|
||||||
raise OSError(msg)
|
raise OSError(msg)
|
||||||
size, data = Image.core.grabscreen_x11(xdisplay)
|
size, data = Image.core.grabscreen_x11(xdisplay)
|
||||||
im = Image.frombytes("RGB", size, data, "raw", "BGRX", size[0] * 4, 1)
|
|
||||||
if bbox:
|
|
||||||
im = im.crop(bbox)
|
|
||||||
return im
|
|
||||||
except OSError:
|
except OSError:
|
||||||
if (
|
if (
|
||||||
xdisplay is None
|
xdisplay is None
|
||||||
|
@ -89,6 +85,11 @@ def grab(bbox=None, include_layered_windows=False, all_screens=False, xdisplay=N
|
||||||
return im
|
return im
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
else:
|
||||||
|
im = Image.frombytes("RGB", size, data, "raw", "BGRX", size[0] * 4, 1)
|
||||||
|
if bbox:
|
||||||
|
im = im.crop(bbox)
|
||||||
|
return im
|
||||||
|
|
||||||
|
|
||||||
def grabclipboard():
|
def grabclipboard():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user