g2d.fillRect(0, 0, 400, 400);
g2d.setColor(Color.red);
g2d.fillRect(100, 50, 100, 50);
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
PNGTranscoder t = new PNGTranscoder();
TranscoderOutput output = new TranscoderOutput(ostream);
t.writeImage(img, output);
return ostream.toByteArray();
} catch (Exception ex) {
throw new RuntimeException("BackgroundColorTest error");
}