- Processing
- p5.js
- Processing.py
- Processing for Android
- Processing for Pi

- Processing Foundation

This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

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-0001.tif, screen-0002.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-000001.png, line-000002.png, etc.
      saveFrame("line-######.png");
    }
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(). Use the Movie Maker program in the Tools menu to combine these images to a movie. If saveFrame() is used without parameters, it will save files as screen-0000.tif, screen-0001.tif, and so on. You can specify the name of the sequence with the filename parameter, including hash marks (####), which will be replaced by the current frameCount value. (The number of hash marks is used to determine how many digits to include in the file names.) Append a file extension, to indicate the file format to be used: either TIFF (.tif), TARGA (.tga), JPEG (.jpg), or PNG (.png). Image files are saved to the sketch's folder, which may be opened by selecting "Show Sketch Folder" from the "Sketch" menu. Alternatively, the files can be saved to any location on the computer by using an absolute path (something that starts with / on Unix and Linux, or a drive letter on Windows). All images saved from the main drawing window will be opaque. To save images without a background, use createGraphics().
Syntax |
    saveFrame()
    saveFrame(filename)
Parameters |
filename | String: any sequence of letters or numbers that ends with either ".tif", ".tga", ".jpg", or ".png"
Returns | void
Related | save() createGraphics() frameCount

Updated on January 1, 2021 03:38:06am EST
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.