BufferedImage argbImage = new BufferedImage(width, height, imageType);
// from there, create an image with Transparency.BITMASK
Graphics2D g = argbImage.createGraphics();
GraphicsConfiguration gc = g.getDeviceConfiguration();
argbImage = gc.createCompatibleImage(width, height, Transparency.BITMASK);
g.dispose();
// create a red rectangle
g = argbImage.createGraphics();
g.setColor(Color.red);
g.fillRect(0, 0, width, height);