mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
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:
Binary file not shown.
|
Before Width: | Height: | Size: 480 KiB After Width: | Height: | Size: 225 KiB |
@@ -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);
|
||||
Reference in New Issue
Block a user