how to save high quality images from processing PGraphics

Hi, I'm trying to get high quality images from processing but I've got a problem.

this is the code I'm using:

PGraphics big;  
void setup() {  
  big = createGraphics(5000, 5000, JAVA2D); // Create a new PGraphics object 5000x5000px  
  big.beginDraw(); // Start drawing to the PGraphics object  
  size(500, 500, P2D); //size of the on-screen display  
}  

int counter; // counter  
void draw() {  
  counter++; // add 1 to counter  
  if(counter%10 == 0) { // every 10th frame we snap a preview and draws it  
    PImage img = big.get(0, 0, big.width, big.height); //snap an image from the off-screen graphics  
    img.resize(width,height); // resize to fit the on-screen display  
    image(img,0,0); // display the resized image on screen  
  }  

  big.fill(255,0,0);//we fill following with red  
  big.ellipse(random(big.width),random(big.height),10,10);//randomly placed circle  
}  

/** 
* We save on any key 
* this could be done in void close() but safer to have it here. 
*/  
void keyPressed() {  
  big.endDraw(); // finish drawing  
  big.save("highRes.tif"); //save to file - use .tif as format for high-res  
  println("saved"); // nice with some feedback  
}  

it is from: Alexander Salveson Nossum, link: http://alexanno.net/2010/06/high-resolution-output-from-processing-processing-in-hd/comment-page-1/#comment-818

It works with easy sketches but when I try to use a function it fails.

example: big.ellipse(random(width),random(height),40,40);

works

but: void example(){ ellipse(random(width),random(height),40,40); }

big.example();

doesn’t works. (says: ****the function example() does not exist.****)

why is it? there is another way to get better quality captures?

Answers

Sign In or Register to comment.