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

Class

PImage

Name

save()

Examples
PImage tower = loadImage("tower.jpg");
tower.save("outputImage.jpg");


size(100, 100);
PImage tower = loadImage("tower.jpg");
PImage newImage = createImage(100, 100, RGB);
newImage = tower.get();
newImage.save("outputImage.jpg");
Description Saves the image into a file. Images are saved in TIFF, TARGA, JPEG, and PNG format depending on the extension within the filename parameter. For example, "image.tif" will have a TIFF image and "image.png" will save a PNG image. 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. It is not possible to use save() while running the program in a web browser.

To save an image created within the code, rather than through loading, it's necessary to make the image with the createImage() function so it is aware of the location of the program and can therefore save the file to the right place. See the createImage() reference for more information.
Syntax
pimg.save(filename)
Parameters
pimg PImage: any object of type PImage
filename String: a sequence of letters and numbers
Returnsboolean
Updated on May 19, 2014 05:30:03pm PDT

Creative Commons License