I was given a CD full of TIF files for a project I’m working on. I needed to get these into the much more reasonable JPG format in order to put them up on a website. I was able to bulk convert this to JPG with only a few lines of powershell.
#Load required assemblies and get object reference
[Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms“);
#Using Get-ChildItem we search for all files matching our extension recurisvley from the location of the script down.
$files = Get-ChildItem -Exclude $outputdir -Recurse -Include *.tif
foreach($f in $files) {
$i = new-object System.Drawing.Bitmap($f.FullName);
$filename = $f.FullName -replace “.tif$“, “.jpg“
$i.Save($filename, [System.Drawing.Imaging.ImageFormat]::Jpeg);
}