28 lines
803 B
JavaScript
28 lines
803 B
JavaScript
const Jimp = require('jimp');
|
|
|
|
async function fix(path) {
|
|
try {
|
|
console.log(`Processing ${path}...`);
|
|
const image = await Jimp.read(path);
|
|
const w = image.bitmap.width;
|
|
const h = image.bitmap.height;
|
|
// Create new transparent image (int color)
|
|
// 0x00000000 is transparent black
|
|
const newImage = new Jimp(w, h, 0x00000000);
|
|
newImage.composite(image, 0, 0);
|
|
await newImage.writeAsync(path);
|
|
console.log(`Fixed ${path}`);
|
|
} catch (e) {
|
|
console.error(`Error processing ${path}:`, e);
|
|
}
|
|
}
|
|
|
|
async function main() {
|
|
await fix('src-tauri/icons/icon.png');
|
|
await fix('src-tauri/icons/128x128.png');
|
|
await fix('src-tauri/icons/32x32.png');
|
|
await fix('src-tauri/icons/128x128@2x.png');
|
|
}
|
|
|
|
main();
|