Author Posts

October 11, 2013 at 9:36 am

I've been trying different methods to resize jpgs via a script and after creating something that works well I decided to post it here in case someone needs to do the same thing.

$strDRV = Read-Host "Enter Path as either c:\ or \\server\share  "
Set-Location "$strDRV"
$pics=((Get-ChildItem -rec | where {$_.Extension -eq ".jpg" -and $_.Length -gt 500kb}).fullname)
  ForEach ($pic in $pics)
  {
  
c:\IV436\i_view32.exe $pic /silent /jpgq=70 /convert=$pic
# write-host $pic
  }

The only pre-requisite is you have to install Irfanview to run the command-line conversion. It seems to work well so far.

Edited to add:
You could use the erroraction silently continue parameter in case you cannot access certain directories, but in this case I did not add it.

October 11, 2013 at 9:55 am

Thanks for sharing!