471,339 Members | 1,156 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,339 software developers and data experts.

image height and width

14
Hi,
any suggestions on how to get width and height of an image from an image file? And further, how to get the color value at any point of the image?
Sep 4 '07 #1
5 9202
bartonc
6,596 Expert 4TB
Hi,
any suggestions on how to get width and height of an image from an image file? And further, how to get the color value at any point of the image?
That will depend entirely on the type of image and the tools that you are using.
PIL & Tkinter? wxPython? Other? Working with gif, tiff, png, jpeg, etc????
Sep 4 '07 #2
Memozio
14
Hey,
I'm using .png image files. I'm working with FrogLogic configured to use Python language.I've already learned that I can use PIL for that, for example:

from PIL import image
im=Image.image("image.png")
pring im.size

and it will return tuple of the format (width, height). I'm wondering if I can somehow get those values in separate statements so I can store them for future use in my script!?
Sep 4 '07 #3
bartonc
6,596 Expert 4TB
Hey,
I'm using .png image files. I'm working with FrogLogic configured to use Python language.I've already learned that I can use PIL for that, for example:

from PIL import image
im=Image.image("image.png")
pring im.size

and it will return tuple of the format (width, height). I'm wondering if I can somehow get those values in separate statements so I can store them for future use in my script!?
Expand|Select|Wrap|Line Numbers
  1. width, height = im.size
will "unpack" the tuple. This method is used often, but the tuple size must match the variable assignments or it will throw an exception.
Sep 4 '07 #4
Memozio
14
Expand|Select|Wrap|Line Numbers
  1. width, height = im.size
will "unpack" the tuple. This method is used often, but the tuple size must match the variable assignments or it will throw an exception.

Thank you, Mr. Barton)))
it really helped me!
Sep 4 '07 #5
bartonc
6,596 Expert 4TB
Thank you, Mr. Barton)))
it really helped me!
You are quite welcome. That's what we are here for.

Keep posting,
Barton
Sep 4 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Ana | last post: by
9 posts views Thread by Adam | last post: by
1 post views Thread by Blake Versiga | last post: by
1 post views Thread by Mustafa Rabie | last post: by
1 post views Thread by comp.lang.php | last post: by
18 posts views Thread by pecan | last post: by
8 posts views Thread by Kentor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.