Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 25th, 2004, 10:37 PM
Noah_C Noah_C is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 34 Noah_C User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 31 sec
Reputation Power: 5
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

Reply With Quote
  #2  
Old November 26th, 2004, 07:45 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #3  
Old November 26th, 2004, 08:21 PM
Noah_C Noah_C is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 34 Noah_C User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 31 sec
Reputation Power: 5
Works Like a charm.
Thanks!

Reply With Quote
  #4  
Old December 7th, 2004, 02:25 AM
miryln miryln is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: california
Posts: 53 miryln User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 42 m 14 sec
Reputation Power: 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?"

Reply With Quote
  #5  
Old December 7th, 2004, 05:48 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.

Reply With Quote
  #6  
Old December 7th, 2004, 08:05 PM
miryln miryln is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: california
Posts: 53 miryln User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 42 m 14 sec
Reputation Power: 4
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?

Reply With Quote
  #7  
Old December 8th, 2004, 03:51 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.

Reply With Quote
  #8  
Old December 9th, 2004, 01:25 AM
miryln miryln is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: california
Posts: 53 miryln User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 42 m 14 sec
Reputation Power: 4
Question

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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Python Image Library


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT