|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Python Image Library
Code:
import sys import ImageGrab im = ImageGrab.grab(0,0,5,10) print im.size im.show() Alright, I've got it working...Kinda. when I take im = Image.Grab.grab(0,0,5,10) and change that to just (0) it works. I did research on the way to set it up and it is supposed to be set up as following: (x,y, width, height). What am I doing wrong. I have PIL installed and can't figure anything out. Your help is greatly appreciated. Thank You |
|
#2
|
||||
|
||||
|
Your problem, as I see it is that ImageGrab.grab() takes one argument and you are trying to pass it four
. From the PIL documentation, a box is a Tuple of four values so I suspect that you need to do something like this:Code:
import sys import ImageGrab im = ImageGrab.grab((0, 0, 5, 10)) print im.size im.show() Obviously I can't test this myself since I'm working on a Mac and ImageGrab.grab() only works with Windows right now . Hope this helps, Mark. |
|
#3
|
|||
|
|||
|
Works Like a charm.
Thanks! |
|
#4
|
|||
|
|||
|
Hey, Im new at this and I dont know what im doing wrong. I put the exact thing it says to put in for a screenshot but every time it does this:
>>> import sys >>> import ImageGrab Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: No module named ImageGrab >>> What should I do with the "import ImageGrab?" |
|
#5
|
||||
|
||||
|
Since PIL (the Python Imaging Library) doesn't come with the standard Python distribution you'll need to install it yourself. You can download the latest version as an exe (Windows installer) from here:
http://www.pythonware.com/products/pil/index.htm You might also want to read though the "Imagine Python" article in Devsheds Python section: http://www.devshed.com/c/a/Python/Imagine-Python/ Have fun, Mark. |
|
#6
|
|||
|
|||
|
The PIP file from the website does not work for python 2.4 .I downloaded python 2.4, and I am wondering is there any way that I can get the file for (python 2.4). Or do I have to download python 2.3?
|
|
#7
|
||||
|
||||
|
We get this after every major release
, unfortunately you only have two choices - wait for the guys to test, build and add a compatible binary or stick with 2.3 like you mentioned; not a bad idea since it's going to take a little time for all the third party modules to catch up anyway. (This usually doesn't take too long though).Still, If you can't wait to play with the new stuff in Python 2.4 then just take the plunge and have some fun while you're waiting .Mark. |
|
#8
|
|||
|
|||
|
alright thanks:
I just downloaded version 2.3.4 so that I could get the Image Library. I've tried the ImageGrab and it works great.I was wondering if there is anyway for you to abtract an image using something like "Paint program" and paste the abstracted image on an internet game so that the picture would be there but not really the item. Am I too confusing? ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Python Image Library |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|