a port of the Processing Visualization Language
Name

saveFrame()

Examples
int x = 0;
void draw()
{
  background(204);
  if(x < 100) {
    line(x, 0, x, 100);
    x = x + 1;
  } else {
    noLoop();
  }
  // Saves each frame as screen-0000.tif, screen-0001.tif, etc.
  saveFrame(); 
}

int x = 0;
void draw()
{
  background(204);
  if(x < 100) {
    line(x, 0, x, 100);
    x = x + 1;
  } else {
    noLoop();
  }
  // Saves each frame as line-0000.tif, line-0001.tif, etc.
  saveFrame("line-####.tif"); 
}
Description

Saves a numbered sequence of images, one image each time the function is run. To save an image that is identical to the display window, run the function at the end of draw() or within mouse and key events such as mousePressed() and keyPressed(). If saveFrame() is called without parameters, it will save the files as screen-0000.tif, screen-0001.tif, etc. It is possible to specify the name of the sequence with the filename parameter and make the choice of saving TIFF, TARGA, PNG, or JPEG files with the ext parameter. These image sequences can be loaded into programs such as Apple's QuickTime software and made into movies. These files are saved to the sketch's folder, which may be opened by selecting "Show sketch folder" from the "Sketch" menu.

All images saved from the main drawing window will be opaque. To save images without a background, use createGraphics().

Syntax
saveFrame()

saveFrame(filename-####.ext)
Parameters
filename String: any sequence of letters and numbers
ext either "tif", "tga", "jpg", "png"
Returns none
Usage Application
Related save()
createGraphics()

This reference is licensed under the CC BY-NC-SA 2.0 license:

Creative Commons License
Fork me on GitHub