File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -395,13 +395,13 @@ $img = if (-not $noimage) {
395395 if ($image -eq ' wallpaper' ) {
396396 $image = (Get-ItemProperty - Path ' HKCU:\Control Panel\Desktop' - Name Wallpaper).Wallpaper
397397 }
398- if (-not (Test-Path - path $image )) {
399- Write-Error ' Specified image or wallpaper does not exist.'
400- exit 1
401- }
402398
403399 Add-Type - AssemblyName ' System.Drawing'
404- $OldImage = New-Object System.Drawing.Bitmap - ArgumentList (Resolve-Path $image ).Path
400+ $OldImage = if (Test-Path $image - PathType Leaf) {
401+ [Drawing.Bitmap ]::FromFile((Resolve-Path $image ))
402+ } else {
403+ [Drawing.Bitmap ]::FromStream((Invoke-WebRequest $image - UseBasicParsing).RawContentStream)
404+ }
405405
406406 # Divide scaled height by 2.2 to compensate for ASCII characters being taller than they are wide
407407 [int ]$ROWS = $OldImage.Height / $OldImage.Width * $COLUMNS / $ (if ($ascii ) { 2.2 } else { 1 })
You can’t perform that action at this time.
0 commit comments