Giving a sketch copy and paste capability allows sequential copy and save to a graphics application (Photoshop, Paint.NET are suitable) and reverting back to an earlier version by pasting it into the sketch.
As show an image can also be produced using two separate sketches.
The attached file provides a template. Simply place the Java library imports at the top of your sketch and past in the rest of the clipboard code at the end.