Skip to content

Instantly share code, notes, and snippets.

@Manoz
Created August 26, 2015 10:14
Show Gist options
  • Save Manoz/965faa5f4a64f9e0c407 to your computer and use it in GitHub Desktop.
Save Manoz/965faa5f4a64f9e0c407 to your computer and use it in GitHub Desktop.
Recursive Image Optimisation (Windows)
:: Uses 'jpegtran.exe' and 'pngout.exe'. Go Google them.
@echo none
for /d /r %%a in (*) do (
pushd "%%a"
echo processing "%%a"
md "OptimizedJPEGS"
for %%i in (*.jpg) do "C:\imageoptimization\jpegtran.exe" -optimize -progressive -copy none "%%i" "OptimizedJPEGS\%%i"
move /Y "OptimizedJPEGS\*.*" .
rd "OptimizedJPEGS"
for %%i in (*.png) do "C:\imageoptimization\pngout.exe" "%%i"
popd
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment