使用java生成了一张透明的png图片,然后将文字打到图片上,图片就变成一坨黑色了,不透明了,请问有没有人给点建议啊 public static void textMark(String imgPath, String text, Font font,
             Color color, int x, int y, float alpha) {
     try {
             Font Dfont = (font == null) ? new Font("宋体", 20, 13) : font;             Image img = ImageIO.read(new File(imgPath));             BufferedImage image = new BufferedImage(img.getWidth(null), img
                             .getHeight(null), BufferedImage.TYPE_INT_ARGB);
             Graphics2D g = image.createGraphics();             g.drawImage(img, 0, 0, null);
             g.setColor(color);
             g.setFont(Dfont);
             g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP,
                             alpha));
             g.drawString(text, x, y);
             g.dispose();
             FileOutputStream out = new FileOutputStream(imgPath);
             JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
             encoder.encode(image);
             out.close();
     } catch (Exception e) {
             System.out.println(e);
     }
}