// 把候选 logo 处理成 app icon: // - 转 PNG (白色背景填充为透明) // - 缩放到 1024x1024 (electron-builder 推荐) // - 顺便输出 256x256 给 renderer 用 const sharp = require('sharp') const path = require('node:path') const SRC = path.resolve(__dirname, '..', 'resources', 'logo-candidate_004.jpg') async function main() { const out1024 = path.resolve(__dirname, '..', 'resources', 'icon.png') const out256 = path.resolve(__dirname, '..', 'resources', 'icon-256.png') // 缩放到 1024x1024, JPEG 白色背景保持 (Windows 图标习惯) await sharp(SRC) .resize(1024, 1024, { fit: 'cover', position: 'center' }) .png({ quality: 95 }) .toFile(out1024) await sharp(SRC) .resize(256, 256, { fit: 'cover', position: 'center' }) .png() .toFile(out256) console.log('Generated:', out1024, out256) } main().catch(e => { console.error(e); process.exit(1) })