// Create a Buffered Image
Dimension dimension = rectangle.getBounds().getSize();
image = new BufferedImage(dimension.width, dimension.height, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = image.createGraphics();
graphics.translate(-rectangle.getX(), -rectangle.getY());
graph.paint(graphics);
graph.setGridVisible(ConfigurationManager.getConfiguration().isShowGrid()
&& !editor.isTokenGameEnabled());
}