ico格式图片应该包含常见4尺寸
16x16 32x32 48x48 256x256
其他完整尺寸规范信息参考表
dpi | 图标大小 | 比例因子 |
---|---|---|
96 |
16x16 |
1.0 (100%) |
120 |
20x20 |
1.25 (125%) |
144 |
24x24 |
1.5 (150%) |
192 |
32x32 |
2.0 (200%) |
dpi | 图标大小 | 比例因子 |
---|---|---|
96 |
32x32 |
1.0 (100%) |
120 |
40x40 |
1.25 (125%) |
144 |
48x48 |
1.5 (150%) |
192 |
64x64 |
2.0 (200%) |
更多微软ico应用设计参考:图标(设计基础知识) - Win32 apps | Microsoft Learn
maven引入依赖包
<dependency>
<groupId>com.xqlee.image</groupId>
<artifactId>image4j</artifactId>
<version>0.7.2</version>
</dependency>
生成代码参考
public static void main(String[] args) throws Exception {
BufferedImage app16 = ImageIO.read(new File("d:/app@16.png"));
BufferedImage app32 = ImageIO.read(new File("d:/app@32.png"));
BufferedImage app48 = ImageIO.read(new File("d:/app@48.png"));
BufferedImage app256 = ImageIO.read(new File("d:/app@256.png"));
ICOEncoder.write(Arrays.asList(app16, app32, app48, app256), new File("d:/app.ico"));
}
https://blog.xqlee.com/article/2507101040108237.html