Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4415 > unrolled thread
| Started by | PyNewbie <ryan.morrone@gmail.com> |
|---|---|
| First post | 2011-05-01 13:50 -0700 |
| Last post | 2011-05-02 10:48 +0300 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
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
| From | PyNewbie <ryan.morrone@gmail.com> |
|---|---|
| Date | 2011-05-01 13:50 -0700 |
| Subject | PIL Question |
| Message-ID | <b1d97f7b-e9be-431e-8e6c-7b4b2e50e67e@glegroupsg2000goo.googlegroups.com> |
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.
[toc] | [next] | [standalone]
| From | Chris Rebert <clp2@rebertia.com> |
|---|---|
| Date | 2011-05-01 18:00 -0700 |
| Message-ID | <mailman.1050.1304298029.9059.python-list@python.org> |
| In reply to | #4415 |
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
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2011-05-01 22:50 -0400 |
| Message-ID | <mailman.1054.1304304663.9059.python-list@python.org> |
| In reply to | #4415 |
On 5/1/2011 9:00 PM, Chris Rebert wrote: > I would think to a file named "screen_capture.jpg" in the current > working directory. What that is for IDLE, I don't know. At least on windows with 3.2, if one just starts up the shell, it is in the Pythonxy directory. If one runs a file from an edit window, it changes to the directory of the file, so it operates much as if one had run with the command python -i file.py in the directory of file.py. > You can > determine what folder that is by running this in your Python shell: > > from os import getcwd; print(getcwd()) Yes, this gives two different answers in the two cases noted above. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | nirinA raseliarison <nirina.raseliarison@gmail.com> |
|---|---|
| Date | 2011-05-02 10:48 +0300 |
| Message-ID | <mailman.1064.1304322505.9059.python-list@python.org> |
| In reply to | #4415 |
[PyNewbie]
> Question: I can't seem to find the captured image, where does it go?
for me, it just goes to the current working directory:
$ python -i
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import ImageGrab
>>> ImageGrab.grab().save("screen_capture.jpg", "JPEG")
>>> import os
>>> os.listdir(os.getcwd())
['.appcfg_cookies', '.appcfg_nag', '.bash_history', '.idlerc',
'.inputrc', '.povray',
'bootex.log', 'buildBasicDemo.txt', 'glsample.cpp', 'glsample.o',
'log.txt',
'screen_capture.jpg', 'test.c']
>>>
--
nirinA
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web