Created
March 3, 2026 15:31
-
-
Save fredemmott/04fb458fc48884f43849447688876e85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ideal sizes: | |
| # | |
| # https://learn.microsoft.com/en-us/windows/apps/design/style/iconography/app-icon-construction | |
| $sizes = @(16, 20, 24, 30, 32, 36, 48, 60, 64, 72, 80, 96, 128, 256) | |
| $tempFiles = @() | |
| foreach ($size in $sizes) { | |
| $outFile = "AppList.targetsize-$($size).png" | |
| $tempFiles += $outFile | |
| if ( $size -ge 32 ) { | |
| $padding = 2; | |
| } else { | |
| $padding = 0; | |
| } | |
| $fontSize = "$(($size - $padding))x$(($size - $padding))" | |
| $strokeWidth = [math]::Max(1, [math]::Round($size * 0.05)) | |
| $max = $size - 1 | |
| magick -size "${size}x${size}" xc:none ` | |
| +antialias ` | |
| -fill none ` | |
| -fill "rgba(0,255,0,0.1)" -draw "rectangle 0,0,$max,$max" ` | |
| -stroke black -strokewidth 1 -draw "rectangle 0,0,$max,$max" ` | |
| -stroke white -strokewidth 1 -draw "stroke-dashoffset 0.5 stroke-dasharray 1 1 rectangle 0,0,$max,$max" ` | |
| -gravity center ` | |
| -antialias ` | |
| '(' ` | |
| -size "${fontSize}" -background none -font Verdana -fill white label:"$size" ` | |
| '(' +clone -background black -shadow '100x1+0+0' ')' +swap -composite ` | |
| ')' ` | |
| -composite ` | |
| -colors 16 ` | |
| $outFile | |
| } | |
| magick $tempFiles -background transparent -compress zip demoicon.ico |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment