我从http://www.freeiconsweb.com/favicon.ico下载了图标文件。我尝试将 ico 文件转换为 png,如下所示:-
im.convert(['favicon.ico', '-format', '16x16+0+0', 'favicon.png'], function (err, stdout, stderr) {
});
结果:
它为我创建了两个 png 文件。 favicon-0.png
和 favicon-1.png
。
正确结果:
它应该只创建一个文件,即 favicon.png
。
有人知道为什么 imagemagick 创建两个文件吗?
最佳答案
一个 ico 文件可以包含多个图像,而 png 则不能,因此 ImageMagick 为 ico 文件中的每个图像制作一个 png。
来自the Wikipedia page (强调我的):
The ICO file format is an image file format for computer icons in Microsoft Windows. ICO files contain one or more small images at multiple sizes and color depths, such that they may be scaled appropriately.
要仅获取单个图像,您必须指定所需的图像。如需帮助,请参阅(命令行)文档 on reading particular frames of an image .
关于node.js - Imagemagick 自动创建重复文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9986492/