Optimize GAL Photos from AD using Script
Posted on 2014-04-29
Ok so I have a folder with all my photos that I want to add to AD and Outlook to appear on emails. I know I have to optimize each photo to be less than 100x100. I found a free tool ImageMagik and a PS1 to use although Im unsure what I change in the PS1 to get it to work:
My folder is C:\security photos\atlanta
The new pics cna be written to folder: C:\ad photos\atlanta
Here is the PS1 where do I change the input and output folders to the above to get this to work? Thanks
# Use to convert large numbers of contact pictures to optimised 96x96 GAL photos
# Steve Goodman
if (!$InputFolder -or !$InputFolder)
throw "InputFolder and OutputFolder parameters are mandatory";
if (!(Test-Path $InputFolder))
throw "InputFolder not found";
if (!(Test-Path $OutputFolder))
throw "OutputFolder not found";
$FullOutputFolderPath = (Get-Item $OutputFolder).FullName
$Quality = 50;
$Items = Get-ChildItem $InputFolder
if ($Items.Count -eq 0)
throw "No items in folder"
foreach ($Item in $Items)
if ($ValidExt -contains $Item.Extension)
Write-Output "Converting $($Item.FullName)"
.\convert.exe -quality $Quality -depth 8 -strip -thumbnail 96x96^ -gravity Center -crop 96x96+0+0 $Item.FullName "$($FullOutputFolderPath)\$($Item.BaseName).jpg"