Skip to content

Instantly share code, notes, and snippets.

@gyk
Created December 21, 2021 04:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gyk/f2aeb41a735e8e499d612ef5138ba966 to your computer and use it in GitHub Desktop.
Save gyk/f2aeb41a735e8e499d612ef5138ba966 to your computer and use it in GitHub Desktop.
Convert SVG files in a directory into ICOs using ImageMagick
$magickExe = 'C:\Program Files\ImageMagick-7.1.0-Q16-HDRI\magick.exe'
$inPath = 'C:\Users\Joe\Downloads\svg-icons\'
$outPath = 'C:\Users\Joe\Downloads\svg-icons\output\'
foreach ($file in Get-ChildItem -File $inPath)
{
Write-Host "Processing ", $file
$outName = [io.path]::ChangeExtension($file.Name, "ico")
& $magickExe -density 256 -background transparent $file -define icon:auto-resize='64,32,16' -colors 8 (Join-Path $outPath $outName)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment