Search processing.org:

Reference for Processing version 1.0.1+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

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.
It is not possible to use saveXxxxx() methods inside a web browser unless the sketch is signed. To save a file back to a server, see the save to web example.
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()

Updated on November 22, 2008 08:39:25pm PST