BufferedImage buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D gd = buffImg.createGraphics();
//设置透明 start
buffImg = gd.getDeviceConfiguration().createCompatibleImage(width, height, Transparency.TRANSLUCENT);
gd=buffImg.createGraphics();
//设置透明 end
gd.setFont(new Font("微软雅黑", Font.PLAIN, fontHeight)); //设置字体
gd.setColor(Color.ORANGE); //设置颜色
gd.drawRect(0, 0, width - 1, height - 1); //画边框
gd.drawString(drawStr, width/2-fontHeight*drawStr.length()/2,fontHeight); //输出文字(中文横向居中)
return buffImg;