%{$p=[Drawing.Image]::FromFile($_);$p|% Ro* 1;$p.Save($_)}
Input comes from the pipeline.
TIO won't work, what with the file, so the following assumes the cat above was downloaded to C:\Temp.
Try it in a PS 7 Console:
$path = 'C:\Temp\2iORu.png'
$path |
%{$p=[Drawing.Image]::FromFile($_);$p|% Ro* 1;$p.Save($_)}
Invoke-Item $path
Windows PowerShell, 78 bytes
The System.Drawing assembly must be loaded, which costs 20 bytes as compared to Core.
%{Add-Type -A *.*wing;$p=[Drawing.Image]::FromFile($_);$p|% Ro* 1;$p.Save($_)}
Try it in a Windows PowerShell console:
$path = 'C:\Temp\2iORu.png'
$path |
%{Add-Type -A *.*wing;$p=[Drawing.Image]::FromFile($_);$p|% Ro* 1;$p.Save($_)}
Invoke-Item $path
Pretty straightforward:
Starts the %
cmdlet (alias for ForEach-Object)
Adds the assembly System.Drawing (not required in PS Core).
Loads the image file from the pipeline (in $_
) into $p.
Then a bit of golfing can take place: $p|% Ro* 1
pipes the image to % (ForEach-Object) and calls the image's method RotateFlip(RotateFlipType), with 1 being Rotate90FlipNone.
Then the image gets saved to the original location.
Invoke-Item shows the image in the default app for .png. You can of course leave out that line and open it with your favorite viewer.