Bill Hung 2018-11-28 Nagoya function Convert-PNG-to-JPG{ [cmdletbinding()] param([Parameter(Mandatory=$true, ValueFromPipeline=$true)] $Path) process{ if ($Path -is [string]) {$Path = get-childitem $Path} $Path | foreach { $image = [System.Drawing.Image]::FromFile($($_.FullName)); $FilePath = [IO.Path]::ChangeExtension($_.FullName, '.jpg'); $image.Save($FilePath, [System.Drawing.Imaging.ImageFormat]::Jpeg); $image.Dispose(); } } } cd C:\Users\Bill\Pictures\Screenshots Get-ChildItem *.png | Convert-PNG-to-JPG |
Posts >