Javascript 将画布上的图形转换为ICN
是否可以将画布上的图形转换为Mac版的Javascript 将画布上的图形转换为ICN,javascript,canvas,firefox-addon,Javascript,Canvas,Firefox Addon,是否可以将画布上的图形转换为Mac版的.icns 有人知道linux使用什么图标格式吗?回答我关于linux使用什么图标类型的问题 我认为linux使用png图像作为图标。有人能在评论中核实一下吗 关于如何转换为.icns的问题的解决方案 如果有人有其他方法,请分享,我喜欢看到多种方法来做同样的事情,并看到它们之间的差异/怪癖 要在mac中转换为.icns,请在mxr上执行以下操作: 这是经过编辑的代码,因此它不在上述mxr的范围内工作 /** * @param aIcon ns
.icns
有人知道linux使用什么图标格式吗?回答我关于linux使用什么图标类型的问题
我认为linux使用png图像作为图标。有人能在评论中核实一下吗
关于如何转换为.icns的问题的解决方案
如果有人有其他方法,请分享,我喜欢看到多种方法来做同样的事情,并看到它们之间的差异/怪癖
要在mac中转换为.icns,请在mxr上执行以下操作:
这是经过编辑的代码,因此它不在上述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上那样的质量问题。如果没有它的功能,你必须按照它的规格来制作-