当前位置: 首页 > news >正文

网站找不到的原因番禺网站建设优化推广

网站找不到的原因,番禺网站建设优化推广,有哪些做场景秀的网站,html网站如何做seo文章目录 【Java】Java 使用 Graphics2D 在图片上添加文字,并解决图片变红问题完整案例 【Java】Java 使用 Graphics2D 在图片上添加文字,并解决图片变红问题 完整案例 public static void main(String[] args) {try {String filePath "D:\\Works…

文章目录

  • 【Java】Java 使用 Graphics2D 在图片上添加文字,并解决图片变红问题
    • 完整案例

【Java】Java 使用 Graphics2D 在图片上添加文字,并解决图片变红问题

完整案例

    public static void main(String[] args) {try {String filePath = "D:\\Workspace\\XunshuWorkspace\\engage\\engage-service\\uploadPath\\upload\\template\\register-certificate.jpg";Image src = Toolkit.getDefaultToolkit().getImage(filePath);BufferedImage image = BufferedImageBuilder.toBufferedImage(src);Graphics2D g = image.createGraphics();Font font = new Font("宋体", Font.BOLD, 80);g.setFont(font);g.setColor(Color.black);g.drawString("张三", 500, 950);g.drawString("522323199812345678", 1750, 950);String date = "2024-03-01";String end = "2024-03-11";g.drawString(date.substring(0, 4), 550, 1150);g.drawString(date.substring(5, 7), 950, 1150);g.drawString(date.substring(8, 10), 1250, 1150);g.drawString(end.substring(0, 4), 1650, 1150);g.drawString(end.substring(5, 7), 2000, 1150);g.drawString(end.substring(8, 10), 2350, 1150);g.drawString("耳鼻咽喉头颈外科", 1000, 1350);long day = DateUtil.betweenDay(DateUtil.parse(date), DateUtil.parse(end), true);g.drawString(String.valueOf(day), 2800, 1350);String currentDate = DateUtil.today();g.drawString(currentDate.substring(0, 4), 2320, 2100);g.drawString(currentDate.substring(5, 7), 2660, 2100);g.drawString(currentDate.substring(8, 10), 2900, 2100);g.dispose();// ServletOutputStream outputStream = ServletUtils.getResponse().getOutputStream();File output = new File(filePath.replace(".jpg", "-" + UUID.randomUUID() + ".jpg"));ImageIO.write(image, "jpg", output);} catch (IOException e) {throw new RuntimeException(e);}}/*** 使用 ImageIO.read(file); 压缩后的图片会变红改为使用* Toolkit.getDefaultToolkit().getImage*/public static class BufferedImageBuilder {public static BufferedImage toBufferedImage(Image image) {if (image instanceof BufferedImage) {return (BufferedImage) image;}// This code ensures that all the pixels in the image are loadedimage = new ImageIcon(image).getImage();BufferedImage bimage = null;GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();try {int transparency = Transparency.OPAQUE;GraphicsDevice gs = ge.getDefaultScreenDevice();GraphicsConfiguration gc = gs.getDefaultConfiguration();bimage = gc.createCompatibleImage(image.getWidth(null),image.getHeight(null), transparency);} catch (HeadlessException e) {// The system does not have a screen}if (bimage == null) {// Create a buffered image using the default color modelint type = BufferedImage.TYPE_INT_RGB;bimage = new BufferedImage(image.getWidth(null),image.getHeight(null), type);}// Copy image to buffered imageGraphics g = bimage.createGraphics();// Paint the image onto the buffered imageg.drawImage(image, 0, 0, null);g.dispose();return bimage;}}
http://www.yayakq.cn/news/534311/

相关文章:

  • 佛山外贸网站制作公司关键词挖掘排名
  • 上海专业网站建设精英建筑工程教育网官网
  • 在百度上免费做网站页面做网站设计前景怎么样
  • 建设工程网站什么时候可以同步网页棋牌搭建
  • 品辰设计的网站谁做的西安app制作设计公司
  • 音乐网站还可以做020网站建设合同范本
  • 做图书馆网站seo兼职在家怎么做
  • 建站网站模板下载长垣县做网站的
  • 百度站长工具登录方式医院网站主页面设计
  • 网站规划与建设报告怎么写网站开发常用软件是什么
  • 适用的深圳网站定制开发seo快速排名软件平台
  • 做企业网站所需要的资料wordpress实现首页功能能
  • 网站开发流程框架顺德网站
  • 广州洲聚网站开发旅游手机网站模板
  • 百度网站开发基于什么语言奉化网站建设
  • 如何不用代码做网站南宁网站建设制作
  • 网页开发需要的技术汕头seo优化培训
  • 网站门户怎么建设怎样做校园网站
  • 网站专题页面怎么做网页制作基础题
  • 微网站模板制作教程群辉 wordpress汉化
  • 可以跟关键词密度过高的网站交换友情链接吗百度移动网站检测
  • 家居网站模板苏州工业园区劳动局网站做不了合同
  • 做网站开源wordpress插件 商品
  • 东莞专业网站建设看片
  • 推荐一个代做毕业设计的网站定制网站开发方案
  • 手机网站 底部菜单wordpress lms插件
  • 网站建设与管理赚钱吗凡客科技
  • 做故障风的头像的网站国建设网站
  • 网站优化软件推荐制作网站赚钱
  • 做网站是学什么专业好建设网站