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

5 years, 7 months ago.

  • Author
  • #10698

    Topics: 8
    Replies: 33
    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

    Topics: 13
    Replies: 4872
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    Thanks for sharing!

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

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort