因为要做网站所以牵扯到这个图片处理。想将任何一张图片经过java代码处理成圆形的图片。只求源代码。谢谢了在线急等
------解决方案--------------------
- Java code
BufferedImage bi1 = ImageIO.read(...);// 根据需要是否使用 BufferedImage.TYPE_INT_ARGBBuffededImage bi2 = new BufferedImage(bi1.getWidth(),bi1.getHeight(),BufferedImage.TYPE_INT_RGB);Ellipse2D.Double shape = new Ellipse2D.Double(0,0,bi1.getWidth(),bi1.getHeight());Graphics2D g2 = bi2.createGraphic2();g2.setClip(shape);// 使用 setRenderingHint 设置抗锯齿g2.drawImage(bi1,0,0,null);g2.dispose();ImageIO.write(bi2, "png", new File("..."));
------解决方案--------------------