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.
Page Index Toggle Pages: 1
Images?? (Read 1181 times)
Images??
May 5th, 2009, 11:17pm
 
can anyone tell me why this code won't show up with the image when i push play?


PImage img;

void setup(){
 size(900,800);
 img=loadImage("Spaceship1.jpg");
 //img.filter(INVERT); //inverts image colours
}

void draw(){
 image(img,0,0);
 println(img.width);// prints the image width
}
Re: Images??
Reply #1 - May 5th, 2009, 11:27pm
 
and could anyone tell me how to move and resize this image in processing- is this possible??

PImage img;

void setup(){
 size(900,800);
 img=loadImage("flag2.png");
 //img.filter(INVERT); //inverts image colours
}

void draw(){
 image(img,0,0);
 println(img.width);// prints the image width
}
Re: Images??
Reply #2 - May 6th, 2009, 2:51am
 
http://processing.org/reference/image_.html

image(img, x, y, width, height)

"The images must be in the sketch's "data" directory to load correctly."

"the x and y parameters define the location of the image from its upper-left corner. The image is displayed at its original size unless the width and height parameters specify a different size."
Re: Images??
Reply #3 - May 6th, 2009, 1:17pm
 
Thanks! i know most of my questions are simple but its hard for me to spot where i went wrong!

thanks again
Page Index Toggle Pages: 1