Something like off the top of my head
int width=100, height=100;
BufferedImage bi = new BufferedImage(width, height, BufferedImage.SCALE_SMOOTH);
Graphics2D g2d = bi.createGraphics();
// Manipulate your g2d graphic
g2d.dispose();
ImageIO.write(bim, "png", new File("out.png"));