Skip to content

Instantly share code, notes, and snippets.

@sixlettervariables
Created July 23, 2014 17:18
Show Gist options
  • Save sixlettervariables/c9c8a880e0a2edc09e61 to your computer and use it in GitHub Desktop.
Save sixlettervariables/c9c8a880e0a2edc09e61 to your computer and use it in GitHub Desktop.
Batch compression of PNG's with OptiPNG for Windows (non-recursive, same directory)
::
:: Non-recursive OptiPNG batch conversion.
:: Based on http://superuser.com/a/604502
::
:: Caveats: 1. Will reduce colorspace if possible (Color -> Grays)
:: 2. Will overwrite images in-place
::
@echo off
echo.
set apppath="OptiPNG.exe"
if [%1]==[] echo Usage: %0 "PNG Dir" && echo. && echo Error: Invalid parameters && goto :EOF
if not exist %1 echo Usage: %0 "PNG Dir" && echo. && echo Error: Invalid directory "%~1" && goto :EOF
%apppath% "%~1\*.png" -zc9 -zm9 -zs3 -f0-5 -strip "all"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment