472,992 Members | 3,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 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 9370
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

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

Similar topics

7
by: Ana | last post by:
I just ran a report on a site I'm redesigning and came up with all these missing height/width tags. How important are they? Should I go through the trouble of making sure they're there? Ana
1
by: Pums | last post by:
How to get the information(like height, width) of an image to be uploaded?
9
by: Adam | last post by:
Can someone please help!! I am trying to figure out what a font is? Assume I am working with a fixed font say Courier 10 point font Question 1: What does this mean 10 point font Question 2:...
1
by: Blake Versiga | last post by:
After pulling an image from the data base and the Image.Height and Image.Width are not set to the ImageURL's attributes. 1) Is there a way to have these properties updated? or 2) How do I get...
1
by: Mustafa Rabie | last post by:
dear all, i am writing an application where the user can upload his own picture. I wanted to get the Width and Height of the uploaded picture. So i assigned the uploaded image to an aspnet...
1
by: comp.lang.php | last post by:
Sorry folks, I'm on a roll!!! I need to calculate the height or width of an image if you change either the width or height and don't change BOTH of them at the same time, this is to "vector" the...
18
by: pecan | last post by:
I have hundreds of pictures on my site. The thumbnails are all a standard size, and most of the bigger ones are the same size too. When I run my html code through my optimizer it throws out a...
8
by: Kentor | last post by:
Hello, I have users that submit images to my website. By default I choose to make the width bigger than the height because usually pictures are taken horizontally... But in some cases people take...
2
by: bizt | last post by:
Hi, Is it possible to obtain the width/ height of an image when that image is dyanically created using a PHP script and passing GET attributes. For example: <img...
2
by: vishwa Ram | last post by:
Hi all, How to get tiff image height and width using Image object in VB. Thanks, vishwa Ram.
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.