水印

import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class SUIyin {
 public static void main(String[] args) throws IOException {
  BufferedImage i= ImageIO.read(new File("D:\\src\\timg[5].jpg"));
  Graphics g = i.getGraphics();
  
  g.setFont(new Font("微软雅黑",Font.BOLD,50));
  g.drawString("王昭君", 40,160);
  g.dispose();
  ImageIO.write(i,"jpg",new File("D:\\src\\timg[5].jpg"));
 }
}
運行結果

 

 

posted @ 2020-06-12 20:00  信王勤宝  阅读(131)  评论(0编辑  收藏  举报