Name

save()

Description

Saves an image from the display window. Append a file extension to the name of the file, to indicate the file format to be used: either TIFF (.tif), TARGA (.tga), JPEG (.jpg), or PNG (.png). If no extension is included in the filename, the image will save in TIFF format and .tif will be added to the name. These 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().

Examples

  • line(20, 20, 80, 80);
    // Saves a TIFF file named "diagonal.tif"
    save("diagonal.tif");
    // Saves a TARGA file named "cross.tga"
    line(80, 20, 20, 80);
    save("cross.tga");
    

Syntax

  • save(filename)

Parameters

  • filename(String)any sequence of letters and numbers

Return

  • void