import ImageGrab fails on Ubuntu 10.4

N

News123

Hi,

It's the first time I wanted to use ImageGrab.

importing ImageGrab fails as seen below:


$ python -c "import ImageGrab"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.6/dist-packages/PIL/ImageGrab.py", line 34, in
<module>
import _grabscreen
ImportError: No module named _grabscreen
$


Is this an issue for all Ubuntu 10.4 releases or is this only failing on
my host?


Thanks in advance
 
N

News123

importing ImageGrab un Ubuntu 10.4 fails as seen below:

import _grabscreen
ImportError: No module named _grabscreen


Well I found a partial answer on
http://www.pythonware.com/library/pil/handbook/imagegrab.htm
The ImageGrab module can be used to copy the contents of the screen or the clipboard to a PIL image memory.

The current version works on Windows only.


I just wonder why there is no cleaerer message like

"platform not supported"


As a workaround I use now:

cmd = "import -window root %s" % fname
os.system(cmd)
img = Image.open(fname)

using the 'import' command of the ImageMagick tool kit

Is there any other way to make screen shots in Linux, ideally without
creating an intermediate file
 
L

Lawrence D'Oliveiro

Is there any other way to make screen shots in Linux, ideally without
creating an intermediate file

The ImageMagick “import†command lets you grab the contents of any window
(including the root window) from your X server
<http://www.imagemagick.org/script/import.php>. It wants an output filename,
but of course that can be /dev/stdout, e.g.

import -window root /dev/stdout | display
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top