ICOFile ico = new ICOFile(f.toURL());
List list = ico.getImages();
if(!list.isEmpty()){
Image image = (Image) list.get(0);
image = image.getScaledInstance(30, 30, Image.SCALE_SMOOTH);
BufferedImage bufimg = new BufferedImage(30,30,BufferedImage.TYPE_INT_RGB);
Graphics2D g=bufimg.createGraphics();
bufimg=g.getDeviceConfiguration().createCompatibleImage(30, 30,Transparency.TRANSLUCENT);
g.dispose();
g=bufimg.createGraphics();
g.setColor(new Color(255,0,0));
g.setStroke(new BasicStroke(1));
g.drawImage(image, 0, 0, null);
g.dispose();
ImageIO.write(bufimg, "PNG", response.getOutputStream());
}
aclibico-2.1.jar 自己下载