Png转ico
本文介绍使用 ImageMagick 的 convert 命令将 PNG 转换为包含 16 至 256 多尺寸的 ICO 图标文件,并用 identify -verbose 配合 grep 查看 ICO 内部各图像尺寸的验证方法。
转换ico
方法一:使用 ImageMagick(推荐,Linux 命令行)
安装 ImageMagick:
sudo apt install imagemagick # Debian/Ubuntu转换命令:
# 生成包含多种尺寸的 favicon.ico
convert -background none -density 300 favicon.png \
-define icon:auto-resize=16,32,48,64,128,256 favicon.ico查看ico文件
使用 identify -verbose 命令检查 ICO 文件内部包含的图像尺寸。
identify -verbose favicon.ico | grep "geometry:"输出示例(多尺寸 ICO):
$ identify -verbose favicon.ico | grep "geometry:"
Page geometry: 16x16+0+0
Page geometry: 32x32+0+0
Page geometry: 48x48+0+0
Page geometry: 64x64+0+0
Page geometry: 128x128+0+0
Page geometry: 256x256+0+0
geometry: 16x16
geometry: 32x32
geometry: 48x48
geometry: 64x64
geometry: 256x256- 原文作者:生如夏花
- 原文链接:https://DBL2017.github.io/post/%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8/png%E8%BD%ACico/
- 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。