Resize JPG Script

Welcome Forums General PowerShell Q&A Resize JPG Script

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
5 years, 2 months ago.

  • Author
    Posts
  • #10698

    Participant
    Points: 0
    Rank: Member

    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

    Keymaster
    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    Thanks for sharing!

The topic ‘Resize JPG Script’ is closed to new replies.