We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › width and height of an image
Page Index Toggle Pages: 1
width and height of an image (Read 515 times)
width and height of an image
Apr 21st, 2008, 7:25pm
 
I'm making a sort of slideshow of images. The only problem is that i need to have the width and height of every single picture, to place them in the center of the screen.

I already had a solution, but you had to do every single change by hand.
How can i achieve this through processing?

Berend
Re: width and height of an image
Reply #1 - Apr 21st, 2008, 7:42pm
 
http://processing.org/reference/PImage.html

PImage has width and height methods
Re: width and height of an image
Reply #2 - Apr 21st, 2008, 8:11pm
 
I'm not sure about this, but those methods don't give me any information about the width and height. For example,the copy method doesn't give me something, you still need to do the parameters yourself.
Re: width and height of an image
Reply #3 - Apr 21st, 2008, 8:18pm
 
The PImage will tell you how big it is, e.g.

Code:
PImage myImg=loadImage("test.jpg");
println("Width: "+ myImg.width);
println("Height: "+ myImg.height);
Re: width and height of an image
Reply #4 - Apr 21st, 2008, 8:20pm
 
o, i didn't know that..
thank you very much!
Page Index Toggle Pages: 1