创建多分辨率图标 [英] Create multi-resolution favicon
问题描述
我正在寻找一种从单个图像创建favicon.ico的方法,但是,所有分辨率都存在一些问题.
I'm looking for a way to create a favicon.ico from a single image, however, I'm having some problems with all the resolutions.
我已经尝试了在多个论坛帖子和网站上建议的转换-file1- -file2- favicon.ico",但这并不是我想要的.
I've tried 'convert -file1- -file2- favicon.ico' as suggested on several forum posts and websites, but that is not exactly what I want.
推荐答案
经过一番搜索,我提出了两种解决方案:
After a bit of searching I came up with 2 solutions:
您可以登录安装了ImageMagick的任何Linux机器,将源图像(分辨率至少为256x256像素和PNG格式文件)重命名为"favicon.png",然后运行以下命令:
You could just log into any linux box with ImageMagick installed, rename your source image (with a resolution of at least 256x256 pixels and a PNG format file) to 'favicon.png', and run the following command:
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烘焙到一个文件中.
.. and you'll have your favicon.ico with most well-known formats baked right into one file.
请务必查看favicon备忘单@ https://github.com/audreyr/favicon-cheat-sheet 获取更多favicon信息.
Be sure to checkout the favicon cheat sheet @ https://github.com/audreyr/favicon-cheat-sheet for more favicon information.
冒着推广最终将变成付费服务的网站的风险:
At the risk of promoting a site which will eventually turns into a paid service:
对于那些没有Imagemagick或不知道如何做的人 实现这些图标,看看我得到的这个提示 http://realfavicongenerator.net/ ..它还会生成HTML代码, 为您提供了一些有关如何渲染某些文件的其他选择 平台.
For those of you without Imagemagick or no knowledge on how to implement these favicons, have a look at this tip I got about http://realfavicongenerator.net/ .. it also generates HTML code and gives you a couple of extra options on how to render the file for certain platforms.
这篇关于创建多分辨率图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!