Skip to content

Instantly share code, notes, and snippets.

@spajak
Last active January 3, 2023 06:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spajak/3c80d338e363715cbbc16f3b998a0ada to your computer and use it in GitHub Desktop.
Save spajak/3c80d338e363715cbbc16f3b998a0ada to your computer and use it in GitHub Desktop.
Simple script to convert PNG image to Windows ICO format using ImageMagick
param(
[String] $png
)
$root = Split-Path "$png" -Parent
$name = Split-Path "$png" -LeafBase
$icon = Join-Path $root ($name + ".ico")
& magick "$png" -strip -background none `
-gravity center -extent "%[fx:max(w,h)]x%[fx:max(w,h)]" `
-define icon:auto-resize=16,24,32,48,64,128 "$icon"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment