mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-22 14:01:31 -06:00
1891ea7966
* Remove All Trailing Whitespace Characters in '.ps1' Files * Remove All Trailing Whitespace Characters in '.json' Files * Remove All Trailing Whitespace Characters in '.yaml' Files * Remove All Trailing Whitespace Characters in Different Files * Remove Even More Trailing Whitespace Characters
27 lines
771 B
PowerShell
27 lines
771 B
PowerShell
function ConvertTo-Icon {
|
|
<#
|
|
|
|
.DESCRIPTION
|
|
This function will convert PNG to ICO file
|
|
|
|
.EXAMPLE
|
|
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath $iconPath
|
|
#>
|
|
param( [Parameter(Mandatory=$true)]
|
|
$bitmapPath,
|
|
$iconPath = "$env:temp\newicon.ico"
|
|
)
|
|
|
|
Add-Type -AssemblyName System.Drawing
|
|
|
|
if (Test-Path $bitmapPath) {
|
|
$b = [System.Drawing.Bitmap]::FromFile($bitmapPath)
|
|
$icon = [System.Drawing.Icon]::FromHandle($b.GetHicon())
|
|
$file = New-Object System.IO.FileStream($iconPath, 'OpenOrCreate')
|
|
$icon.Save($file)
|
|
$file.Close()
|
|
$icon.Dispose()
|
|
#explorer "/SELECT,$iconpath"
|
|
}
|
|
else { Write-Warning "$BitmapPath does not exist" }
|
|
} |