可以将画布上的图形转换为.icns for Mac吗?
有人知道linux使用什么图标格式吗?
发布于 2014-08-27 16:28:17
关于linux使用哪种图标类型的问题的答案
我认为linux使用png图像作为图标。有没有人可以在评论中核实一下。
关于如何转换为.icns的问题的解答
如果任何人有任何其他的方式,请分享,我喜欢看到不同的方式做同样的事情,并看到它们之间的差异/怪癖。
要在mac中转换为.icns,需要在mxr上完成:http://mxr.mozilla.org/mozilla-release/source/toolkit/webapps/MacNativeApp.js#291
这是经过编辑的代码,因此它在上面的mxr范围之外工作。
/**
* @param aIcon nsIFile :: of icon
* @param aPath String :: where you want to save the image and with what name
*/
_processIcon: function(aIcon, aPath) {
let deferred = Promise.defer();
//let tmpIconPath = OS.Path.join(aDir, this.iconFile);
function conversionDone(aSubject, aTopic) {
if (aTopic != "process-finished") {
deferred.reject("Failure converting icon, exit code: " + aSubject.exitValue);
return;
}
// SIPS silently fails to convert the icon, so we need to verify if the
// icon was successfully converted.
OS.File.exists(aPath).then((aExists) => {
if (aExists) {
deferred.resolve();
} else {
deferred.reject("Failure converting icon, unrecognized image format");
}
});
}
let process = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
let sipsFile = FileUtils.getFile("/usr/bin/sips");
process.init(sipsFile);
process.runAsync(["-s", "format", "icns",
aIcon.path,
"--out", aPath,
"-z", "128", "128"],
9, conversionDone);
return deferred.promise;
}我还不能测试它,因为我还没有mac vm,但希望它没有我在windows上做的那样的质量问题。
https://stackoverflow.com/questions/25502417
复制相似问题