Name

saveFrame()

Examples
x = 0

def draw():
    global x
    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()
x = 0

def draw():
    global x
    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
filenameString: any sequence of letters or numbers that ends with either ".tif", ".tga", ".jpg", or ".png"
Related save()
createGraphics()
frameCount

Updated on Mon Sep 21 15:53:25 2020.

If you see any errors or have comments, please let us know.