Resize JPG Script

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 3 years, 8 months ago.

  • Author
    Posts
  • #10698
    Profile photo of notarat
    notarat
    Participant

    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.

  • #10700
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Thanks for sharing!

You must be logged in to reply to this topic.