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 & HelpSyntax Questions › window size adjust to the .jpg picture
Page Index Toggle Pages: 1
window size adjust to the .jpg picture (Read 863 times)
window size adjust to the .jpg picture
Jan 6th, 2008, 8:31pm
 
I'm sorry because it seems to be a bit lazy question,
but I just couldn't find how to do this;

when loading a .jpg file, the P5 window size automatically takes the original image file's size.

thank you...
Re: window size adjust to the .jpg picture
Reply #1 - Jan 7th, 2008, 3:13am
 
You need to load the jpg first (before you set the size())then set the width and height of the window

Code:
PImage img;
img = loadImage("filename.jpg");
size(img.width, img.height);
...
Re: window size adjust to the .jpg picture
Reply #2 - Jan 7th, 2008, 11:10am
 
great! 'working good...

thank you thank you!!
Page Index Toggle Pages: 1