【图片处理】java抗锯齿

            BufferedImage distImage = new BufferedImage(newWidth, newHeight, bufferedImageType);
            
            // 创建新图
            Graphics2D graphics2d = distImage.createGraphics();

            // 设置“抗锯齿”的属性
            graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            graphics2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
            
            graphics2d.drawImage(srcImage.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH), 0, 0, null);
            

 

你可能感兴趣的:(java)