Powershell/Private/Get-ImageFromB64.ps1
function Get-ImageFromB64 { param ( [Parameter(Mandatory = $true)] [String]$ImageBase64 ) # Parameter help description $ObjBitmapImage = New-Object System.Windows.Media.Imaging.BitmapImage #Provides a specialized BitmapSource that is optimized for loading images using Extensible Application Markup Language (XAML). $ObjBitmapImage.BeginInit() #Signals the start of the BitmapImage initialization. $ObjBitmapImage.StreamSource = [System.IO.MemoryStream][System.Convert]::FromBase64String($ImageBase64) #Creates a stream whose backing store is memory. $ObjBitmapImage.EndInit() #Signals the end of the BitmapImage initialization. $ObjBitmapImage.Freeze() #Makes the current object unmodifiable and sets its IsFrozen property to true. $ObjBitmapImage } |