Created
September 18, 2017 05:25
-
-
Save pinscript/bdb7228743beacf1d25d88725f0d1909 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Compress-Images() { | |
if(!(Test-Path -Path "Compressed")) { | |
New-Item -ItemType Directory -Force -Path "Compressed" | |
} | |
if((Get-Command "guetzli_windows_x86-64.exe" -ErrorAction SilentlyContinue) -eq $null) { | |
Write-Host "Could not find guetzli_windows_x86-64.exe in path." | |
} | |
$files = Get-ChildItem -Filter *.jpg | |
foreach($file in $files) { | |
$name = $file.Name | |
Write-Host "Compressing $($name)" | |
guetzli_windows_x86-64.exe --quality 84 "$($name)" "Compressed/$($name)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment