Advertisement
netgrind

autogif.bat

Aug 28th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.46 KB | None | 0 0
  1. ::by cale bradbury netgrind.net
  2. ::requires imagemagick to be installed
  3. ::call autogif.bat from the cmd line with the output name of the gif
  4. ::>autogif.bat gifname.gif
  5. @echo off
  6. cd %~dp0
  7. SET numColors=256
  8. :while1
  9. echo creating gif with %numColors% colors
  10. convert *.png -colors %numColors% %1
  11. SET  /a gifFileSize=%~z1/1024/1024
  12. echo gif size %gifFileSize% MB
  13. if %~z1 gtr 2097152 (
  14.     SET /a "numColors=%numColors%/2"
  15.     if %numColors% gtr 8 (
  16.         goto :while1
  17.     )
  18. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement