Loading...
Logo
Processing Forum
It looks like the save() functions do not work. Is there another way to save a processing screen?

Replies(1)

Be aware that processing.js cannot save a file to your harddisk, because of the javascript security model. Instead, pjs will place the image in a new window for you to manually save to disk. The following code is a demonstration of this:


Copy code
  1. void setup()
  2. {
  3.   size(200,200);
  4.   noLoop();
  5. }

  6. void draw()
  7. {
  8.   background(0);
  9.   for(int i=0; i<1000; i++)
  10.   {
  11.     stroke(random(100,255),random(100,255),random(100,255),15);
  12.     line(0,0,width,random(height));
  13.     line(0,0,random(width),height);
  14.   }
  15.   save("mypic.png");
  16. }