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 › A simple loadimage question
Page Index Toggle Pages: 1
A simple loadimage question (Read 479 times)
A simple loadimage question
Nov 27th, 2009, 5:05pm
 
Hey guys,

I'm just learning how to use processing and I'm having trouble using "loadimage". I added the file to the data directory, but there is a message saying, "cannot find anything named "monet.""

Here is the code:

void setup(){  
 monet = loadImage("monet.jpg");
 size(monet.width, monet.height);                              
 noStroke();  
 noLoop();  
 colorMode(HSB);
 noSmooth();
 background(255);  
   
}  
 
void draw(){  
 float sp = 6;
   for(int y = 0; y < height; y += sp){
   for(int x = 0; x < width; x += sp){  
     color c = monet.get(x,y);
     pincel(x, y, c, sp);
     
}  
 }  
}  
 
void pincel(float x, float y, color c, float amp){
 int puntos = round(random(10));
 for(int i  = 0; i <= puntos; i++){  
   float h = hue(c);
   float s = saturation(c) + random(80);
   float b = brightness(c) + random(80);
   pushMatrix();  
   translate(x, y);
   rotate(random(PI));
   fill(h,s*9,b);  
   float tam = random(amp/2);  
   ellipse(random(-amp, amp), random(-amp, amp), random(100), random(10));
   popMatrix();        
 
 }  
}  


Thanks a lot, I appreciate your help!
Re: A simple loadimage question
Reply #1 - Nov 27th, 2009, 5:29pm
 
you forgot to declare it...
add PImage monet; before setup
Re: A simple loadimage question
Reply #2 - Nov 27th, 2009, 6:13pm
 
Thanks you, it works fine now!
Page Index Toggle Pages: 1