Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4428

Re: PIL Question

References <b1d97f7b-e9be-431e-8e6c-7b4b2e50e67e@glegroupsg2000goo.googlegroups.com>
Date 2011-05-01 18:00 -0700
Subject Re: PIL Question
From Chris Rebert <clp2@rebertia.com>
Newsgroups comp.lang.python
Message-ID <mailman.1050.1304298029.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, May 1, 2011 at 1:50 PM, PyNewbie <ryan.morrone@gmail.com> wrote:
> Hi,
>
> I'm new with Python and PIL. I have a very simple question regarding an image capture function I'm attempting.
>
> Here is the code:
>
>
>>>> from PIL import ImageGrab
>>>> ImageGrab.grab().save("screen_capture.jpg", "JPEG")
>
> Question: I can't seem to find the captured image, where does it go?  The python Shell IDE does not display an error, and the code appears to have been processed.
>
> Additional Info: I'm using Python 2.6, and PIL 1.1.7 for Python 2.6 Windows.

I would think to a file named "screen_capture.jpg" in the current
working directory. What that is for IDLE, I don't know. You can
determine what folder that is by running this in your Python shell:

from os import getcwd
print(getcwd())

Also, I would suggest using absolute file paths in the future, rather
than relative ones; e.g. "C:/Documents and Settings/Your
username/Desktop/screen_capture.jpg" rather than just
"screen_capture.jpg".

Cheers,
Chris

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

PIL Question PyNewbie <ryan.morrone@gmail.com> - 2011-05-01 13:50 -0700
  Re: PIL Question Chris Rebert <clp2@rebertia.com> - 2011-05-01 18:00 -0700
  Re: PIL Question Terry Reedy <tjreedy@udel.edu> - 2011-05-01 22:50 -0400
  Re: PIL Question nirinA raseliarison <nirina.raseliarison@gmail.com> - 2011-05-02 10:48 +0300

csiph-web