日期:2014-05-20 浏览次数:20764 次
public static void main(String[] args) {
try {
File file = new File("yang.png");
BufferedImage image = ImageIO.read(file);
Graphics2D g2 = image.createGraphics();
g2.setColor(Color.red);
g2.drawString("a test string!", image.getWidth() - 120, image.getHeight() - 14);
g2.dispose();
ImageIO.write(image, "png", file);
} catch (IOException e) {
e.printStackTrace();
}
}