36 lines
939 B
JavaScript
36 lines
939 B
JavaScript
const sharp = require('sharp');
|
|
|
|
async function padIcon() {
|
|
console.log('Padding icon using Sharp...');
|
|
|
|
// 1. Create Icon.png (1024x1024, #050510 background)
|
|
// Scale original to 800x800 for iOS
|
|
await sharp('Icon-original.png')
|
|
.resize(750, 750, { fit: 'contain' })
|
|
.extend({
|
|
top: 137,
|
|
bottom: 137,
|
|
left: 137,
|
|
right: 137,
|
|
background: '#050510'
|
|
})
|
|
.toFile('Icon.png');
|
|
console.log('Icon.png (iOS) created.');
|
|
|
|
// 2. Create Icon-padded.png (1080x1080, transparent background)
|
|
// Scale original to 650x650 for Android adaptive icon safe zone
|
|
await sharp('Icon-original.png')
|
|
.resize(650, 650, { fit: 'contain' })
|
|
.extend({
|
|
top: 215,
|
|
bottom: 215,
|
|
left: 215,
|
|
right: 215,
|
|
background: { r: 0, g: 0, b: 0, alpha: 0 }
|
|
})
|
|
.toFile('Icon-padded.png');
|
|
console.log('Icon-padded.png (Android) created.');
|
|
}
|
|
|
|
padIcon().catch(console.error);
|