java 水印图标 (解释源码)

it2025-02-25  25

话不多说上源码

//水印图标 public void WatermarkIcon(String src, String imagedst, String dst, int x, int y, int w, int h) throws IOException { //底图 BufferedImage bis = ImageIO.read(new File(src)); //水印图标 BufferedImage bid = ImageIO.read(new File(imagedst)); Graphics2D g = bis.createGraphics(); //第一组是将读取的图片写在什么位置 第二组坐标是从什么范围开始读原文件 g.drawImage(bid, 0, 0, 300, 200, 0, 0, bid.getWidth(), bid.getHeight(), null); ImageIO.write(bis, "jpg", new FileOutputStream(dst)); g.dispose(); }
最新回复(0)