Add script to create ICO from SVG

It requires Inkscape and ImageMagick to be installed. This does not
replace the existing icon.ico file because of issues integrating the
script into the CI build system, but at least the process is now
documented and reproducible. Closes #713.
This commit is contained in:
Oliver Hamlet
2016-12-01 19:03:12 +00:00
parent 66dcb29d10
commit 7e2f071aec
2 changed files with 33 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
const childProcess = require('child_process');
const fs = require('fs-extra');
const path = require('path');
const svgPath = path.join('resources', 'icon.svg');
const buildDirectory = path.join('build', 'icon');
const outputPath = path.join('resources', 'icon.ico');
const sizes = [16, 20, 24, 30, 32, 36, 40, 48, 60, 64, 72, 80, 96, 128, 256];
fs.mkdirsSync(buildDirectory);
const convertArgs = [];
sizes.forEach((size) => {
const pngFile = path.join(buildDirectory, `icon-${size}.png`);
convertArgs.push(pngFile);
childProcess.execFileSync('inkscape', [
'-z',
'-e',
pngFile,
'-w',
size,
'-h',
size,
svgPath,
]);
});
convertArgs.push(outputPath);
childProcess.execFileSync('convert', convertArgs);
fs.removeSync(buildDirectory);