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.





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

size(100, 100);
PImage tower = loadImage("tower.jpg");
PImage newImage = createImage(100, 100, RGB);
newImage = tower.get();"outputImage.jpg");
Description Saves the image into a file. 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.

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.
pimg PImage: any object of type PImage
filename String: a sequence of letters and numbers
Updated on October 2, 2018 05:02:10pm EDT

Creative Commons License