Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve incorrect resolution when dpi is set #126

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow passing remote URL for image path
  • Loading branch information
rashil2000 committed Feb 6, 2022
commit 938dde7f6e2fb5a697ac212fa70faea4a7954f8a
10 changes: 5 additions & 5 deletions winfetch.ps1
Original file line number Diff line number Diff line change
@@ -395,13 +395,13 @@ $img = if (-not $noimage) {
if ($image -eq 'wallpaper') {
$image = (Get-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name Wallpaper).Wallpaper
}
if (-not (Test-Path -path $image)) {
Write-Error 'Specified image or wallpaper does not exist.'
exit 1
}

Add-Type -AssemblyName 'System.Drawing'
$OldImage = New-Object System.Drawing.Bitmap -ArgumentList (Resolve-Path $image).Path
$OldImage = if (Test-Path $image -PathType Leaf) {
[Drawing.Bitmap]::FromFile((Resolve-Path $image))
} else {
[Drawing.Bitmap]::FromStream((Invoke-WebRequest $image -UseBasicParsing).RawContentStream)
}

# Divide scaled height by 2.2 to compensate for ASCII characters being taller than they are wide
[int]$ROWS = $OldImage.Height / $OldImage.Width * $COLUMNS / $(if ($ascii) { 2.2 } else { 1 })