code: public BufferedImage createImage() {
  
  		BufferedImage image = null;
  		Graphics2D graphics = null;
  
  		for (int layer = 0; layer < 4; layer++) {
  
  			BufferedImage layerImage = layeredImage[layer];
  
  			if (layerImage != null) {
  
  				if (image == null) {
  					image = layerImage;
  					graphics = layeredGraphics[layer];
  				} else {
  					graphics.drawImage(layerImage, 0, 0, null);
  					layeredGraphics[layer].dispose();
  					layerImage.flush();
  				}
  
  				layeredImage[layer] = null;
  				layeredGraphics[layer] = null;
  			}
  		}
  
  		if (graphics != null) {
  			graphics.dispose();
  		}
  
  		return image;
  	}
docs: Create the final image from the layers, resets the layers
  
  @return image