Rotate or Flip an Image with PowerShell (System.Drawing)
Use the built-in .NET System.Drawing RotateFlip method to rotate or mirror a picture from the command line.
01Command
$ Add-Type -AssemblyName System.Drawing; $img=[System.Drawing.Image]::FromFile('C:\Users\me\photo.jpg'); $img.RotateFlip([System.Drawing.RotateFlipType]::Rotate90FlipNone); $img.Save('C:\Users\me\photo-rot.jpg'); $img.Dispose()02What it does
System.Drawing ships with Windows and needs no installs. RotateFlipType combines rotation (90/180/270) and mirroring (FlipX/FlipXY) in a single enum, so a vertical phone photo becomes horizontal in one call. Always Dispose the image afterwards or the file stays locked; save to a new filename because JPEG re-encoding is lossy.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Image Class (System.Drawing)Evidence: Documents Image.FromFile, Image.RotateFlip and Image.Save — the three members the one-liner chains together.
- RotateFlipType Enum (System.Drawing)Evidence: Lists every RotateFlipType member (Rotate90FlipNone, Rotate180FlipXY, etc.) used by Image.RotateFlip to rotate and mirror an image in place.
Last verified: 2026-09-17 · Category: Media
06Related solutions
Search inside text files and logs with regex, returning file, line number and match.
Create or update a .zip from any files or folder contents straight from PowerShell.
A built-in PowerShell one-liner that answers 'is port 5432/3389/443 actually open through this network?' — no telnet client needed.