The Coder's Handbook

Screenshots

SAVING A SCREENSHOT

Saving Images

To save an image in processing, you can use the command save().


void save(String filename)

  • Saves an image with the specified filename

  • You must include an extension for the image type, such as .png or .jpg


Code:

save("myRobotDude.png");

Note that the file will keep overwriting itself. However, you could use a variable as part or all of the filename. For example:

Code:

save(userName + ".png");

This can be combined with conditionals, loops, and other commands to do things like:

  • Save an image if the mouse is pressed

  • Save an image when the game ends

  • Save a series of images, making a new an image once every 30 seconds

Finding your Sketch folder


The image will automatically be saved to your sketch folder.

To find your sketch folder without browsing the computer, do the following:

  • From the menu bar, select Sketch

    • Under the drop down select Show Sketch Folder
      or

  • Press the hotkey "CTRL-K"

THE OLD FASHIONED WAY

These aren't part of processing, but if you just need a quick picture these windows tools can be handy.

Print Screen


  • If you press print screen it will copy your entire screen to your clipboard

  • Open up Paint and paste the image

Snip Tool


  • Windows-Shift-S brings up the snip tool for a more selective screenshot

  • Open up Paint and paste the image

RESOURCES

  • Chapter 21 - Exporting