mirror of
https://github.com/tauri-apps/tauricon.git
synced 2026-02-04 02:31:20 +01:00
fix(windows): generate 32x32 ico files (#75)
This commit is contained in:
committed by
GitHub
parent
74754209ec
commit
91cb5c0c7f
5
.changes/fix-ico.md
Normal file
5
.changes/fix-ico.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauricon": patch
|
||||
---
|
||||
|
||||
Generate 32x32 ICO icons for better compatibility with the window icon on Windows.
|
||||
@@ -509,14 +509,7 @@ const tauricon = {
|
||||
await this.validate(src, target)
|
||||
|
||||
const s = sharp(src)
|
||||
const metadata = await s.metadata()
|
||||
let icoBuf
|
||||
if (metadata.width !== metadata.height) {
|
||||
const size = Math.min(metadata.width ?? 256, metadata.height ?? 256)
|
||||
icoBuf = await s.resize(size, size).toBuffer()
|
||||
} else {
|
||||
icoBuf = await s.toBuffer()
|
||||
}
|
||||
const icoBuf = await s.resize(32, 32).toBuffer()
|
||||
|
||||
const icns = new Icns()
|
||||
for (const key in icnsImageList) {
|
||||
@@ -532,7 +525,7 @@ const tauricon = {
|
||||
ensureFileSync(path.join(target, '/icon.icns'))
|
||||
writeFileSync(path.join(target, '/icon.icns'), icns.data)
|
||||
|
||||
const out2 = await pngToIco(icoBuf)
|
||||
const out2 = await pngToIco([icoBuf])
|
||||
if (out2 === null) {
|
||||
throw new Error('Failed to create icon.ico')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user