favicon - 创建多分辨率图标

标签 favicon

我正在寻找一种从单个图像创建 favicon.ico 的方法,但是,我在使用所有分辨率时都遇到了一些问题。

我尝试使用以下 ImageMagick 的命令:

convert -file1- -file2- favicon.ico

由于几个论坛帖子和网站上都建议了这一点,但我无法准确地弄清楚......

有人知道怎么做吗?

最佳答案

经过一番搜索,我想出了两个解决方案:

解决方案#1:

您只需登录任何安装了 ImageMagick 的 Linux 机器,将源图像(分辨率至少为 256x256 像素和 PNG 格式文件)重命名为“favicon.png”,然后运行以下命令:
convert favicon.png -bordercolor white -border 0 \
      \( -clone 0 -resize 16x16 \) \
      \( -clone 0 -resize 32x32 \) \
      \( -clone 0 -resize 48x48 \) \
      \( -clone 0 -resize 57x57 \) \
      \( -clone 0 -resize 64x64 \) \
      \( -clone 0 -resize 72x72 \) \
      \( -clone 0 -resize 110x110 \) \
      \( -clone 0 -resize 114x114 \) \
      \( -clone 0 -resize 120x120 \) \
      \( -clone 0 -resize 128x128 \) \
      \( -clone 0 -resize 144x144 \) \
      \( -clone 0 -resize 152x152 \) \
      -delete 0 -alpha off -colors 256 favicon.ico

.. 您将拥有最知名格式的 favicon.ico 直接烘焙到一个文件中。

请务必查看网站图标备忘单@ https://github.com/audreyr/favicon-cheat-sheet了解更多网站图标信息。

解决方案#2:

冒着推广最终会变成付费服务的网站的风险:

For those of you without Imagemagick or no knowledge on how to implement these favicons, have a look at this tip I got about https://realfavicongenerator.net/ .. it also generates HTML code and gives you a couple of extra options on how to render the file for certain platforms.

关于favicon - 创建多分辨率图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23375608/

相关文章:

html - 需要为 favicon.ico 添加链接标签吗?

iphone - 加载 ico 图像会切换红色 channel 和蓝色 channel

html - 在 Node JS 中登录后/favicon.ico

ruby-on-rails - 如何从我的 Rails 应用程序中删除图标

swagger - NestJs Swagger如何添加自定义图标

html - Favicon 在 IE11 中不工作;适用于 FF 和 Chrome

c++ - 有什么办法可以给我的应用程序一个图标?

webpack-dev-server - Webpack Dev Server - 图标未显示在本地主机上,但适用于外部 URL

favicon - favicon.ico 是否需要驻留在 index.html 的同一目录中?

ios - Apple ios Safari 书签 favicon 不起作用,添加到桌面有效