Files
MrTerm/scripts/make-icons.js
T

15 lines
835 B
JavaScript

// Erzeugt App-Icons aus assets/logo-full.png: npx electron scripts/make-icons.js
const { app, nativeImage } = require('electron');
const fs = require('fs');
app.whenReady().then(() => {
const src = nativeImage.createFromPath('assets/logo-full.png');
const { width } = src.getSize();
const k = width / 1254;
// Ausschnitt: Kopf mit Hut, ohne Schriftzug
const head = src.crop({ x: Math.round(282 * k), y: Math.round(172 * k), width: Math.round(706 * k), height: Math.round(706 * k) });
fs.writeFileSync('build/icon.png', head.resize({ width: 512, height: 512, quality: 'best' }).toPNG());
fs.writeFileSync('src/renderer/logo.png', head.resize({ width: 96, height: 96, quality: 'best' }).toPNG());
fs.writeFileSync('assets/icon.png', head.resize({ width: 256, height: 256, quality: 'best' }).toPNG());
app.quit();
});