Skip to content

Instantly share code, notes, and snippets.

@daisyUniverse
Created February 18, 2026 21:05
Show Gist options
  • Select an option

  • Save daisyUniverse/fb97e6a38def038754739978d6ba8551 to your computer and use it in GitHub Desktop.

Select an option

Save daisyUniverse/fb97e6a38def038754739978d6ba8551 to your computer and use it in GitHub Desktop.
resize an image with powershell
param( [string]$src, [string]$out, [int32]$he, [int32]$wi )
Add-Type -AssemblyName System.Drawing
$w = [System.Drawing.Image]::FromFile((Get-Item $src))
$a = New-Object System.Drawing.Bitmap($wi, $he)
$g = [System.Drawing.Graphics]::FromImage($a)
$g.DrawImage($w, 0, 0, $wi, $he)
$g.Dispose(); $w.Dispose(); $a.Save($out); $a.Dispose()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment