Skip to content
This repository has been archived by the owner on Sep 17, 2022. It is now read-only.

Commit

Permalink
fix(windows): generate 32x32 ico files (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Jul 6, 2022
1 parent 7475420 commit 91cb5c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-ico.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauricon": patch
---

Generate 32x32 ICO icons for better compatibility with the window icon on Windows.
11 changes: 2 additions & 9 deletions src/tauricon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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')
}
Expand Down

0 comments on commit 91cb5c0

Please sign in to comment.