I have a code to batch convert a folder of jpg files to BMP.
The code i have works OK, but it gets saved as BMP 24 bits.
I need it to convert it to BMP 16 bits using Powershell
function ConvertImage{
$Origen="C:\jpg" #path to files
$Destino="C:\bmp" #path to files
if (Test-Path $Origen)
{
#Load required assemblies and get object reference
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
foreach($file in (Get-ChildItem -Path "$Origen\*.jpg" -Exclude *-*)){
$convertfile = new-object System.Drawing.Bitmap($file.Fullname)
$newfilname = $Destino + '\' + $file.BaseName + '.bmp'
$convertfile.Save($newfilname, "bmp")
$file.Fullname
}
}
else
{
Write-Host "Path not found."
}
};ConvertImage -path $args[0]