1、将png等格式的图片转成ico格式
使用支持图片格式转换的软件或工具,如:Photoshop、ImageMagick等。
接下来使用ImageMagick转换图片格式。
官网:https://imagemagick.org/
方式1:执行ImageMagick命令
详见:
https://imagemagick.org/script/command-line-processing.php
https://usage.imagemagick.org/
# 下载地址:https://imagemagick.org/script/download.php#windows
# 安装包1:https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-41-Q16-HDRI-x64-dll.exe
# 安装包2(免安装):https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-41-portable-Q16-HDRI-x64.zip
# 命令说明:ImageMagick.exe 源文件 目标文件
magick.exe xx.png favicon.ico
magick.exe xx.png -resize 64x64 favicon.ico
方式2:编写Python代码
1)安装ImageMagick:
详见:
https://docs.wand-py.org/en/latest/guide/install.html#
install-imagemagick-on-windows
2)使用pip下载MagickWand library:
pip install Wand
3)编写Python代码:
详见:https://docs.wand-py.org/
from wand.image import Image
img = Image(filename='xx.jpg')
img.resize(64, 64)
img.save(filename='favicon.ico')
img.close()
2、修改html代码
详见:
https://web.developers.google.cn/learn/html/document-structure?hl=zh-cn#other_uses_of_the_link_element
https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/link
示例1:
demo
hello world
示例2:
demo
hello world