Skip to content

Instantly share code, notes, and snippets.

@gatosyocora
Created May 22, 2020 09:16
Show Gist options
  • Save gatosyocora/61beb64a3598ec483efc1cc97290fda5 to your computer and use it in GitHub Desktop.
Save gatosyocora/61beb64a3598ec483efc1cc97290fda5 to your computer and use it in GitHub Desktop.
引数で受け取ったパスの画像を水平反転させるPowerShellのコード
Param(
[parameter(mandatory=$true)][String]$imageUrl
)
Add-Type -AssemblyName System.Drawing
$stream = [System.IO.FileStream]::new(
$imageUrl,
[System.IO.FileMode]::Open,
[System.IO.FileAccess]::ReadWrite)
$srcImage = [System.Drawing.Image]::FromStream($stream)
$stream.Dispose()
$srcImage.RotateFlip("Rotate180FlipY")
$srcImage.Save($imageUrl, [System.Drawing.Imaging.ImageFormat]::Png)
$srcImage.Dispose()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment