zoukankan      html  css  js  c++  java
  • IO水印文字效果

    import java.awt.Color;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import java.util.Random;
    import javax.imageio.ImageIO;
    public class Meinv {
     public static void main(String[] args) throws IOException {
      String src = "D:\Demo\op";
      String dst = "D:\Demo\op\ting3";
      BufferedImage s = ImageIO.read(new File (src));
    int width = s.getWidth();
    int height = s.getHeight();
    BufferedImage black = new BufferedImage(width, height,10);
    black.getGraphics().drawImage(s, 0, 0, width, height,null );
    BufferedImage i = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
    Graphics g = i .getGraphics();
    g.drawImage(black,0,0,width,height,null);
    Random rand = new Random();
    g.setColor(new Color(rand.nextInt(255),rand.nextInt(255),rand.nextInt(255)));
    g.fillRect(0, 0, width, height);

    g.setColor(new Color(255,255,255,120));
    g.setFont(new Font("",Font.BOLD,40));
    int x= width - 200;
    int y = height -40;
    g.drawString("王昭君",x,y);
     }
    }
  • 相关阅读:
    JavaScript学习(二)
    javaScript学习(一)
    CSS学习(一)
    HTML学习(一)
    ES之node机器配置elasticsearch.yml
    ES之master机器配置elasticsearch.yml
    jenkins--前端依赖之 node
    jenkins--邮件插件配置
    JsonPath提取表达式
    this关键字的作用
  • 原文地址:https://www.cnblogs.com/wangqianbao/p/13088796.html
Copyright © 2011-2022 走看看