Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. rem https://www.imagemagick.org
  3. setlocal enableextensions enabledelayedexpansion
  4.  
  5. set convert=c:\Programs\ImageMagick-7.0.6-0\convert.exe
  6. set magic=c:\Programs\ImageMagick-7.0.6-0\magick.exe
  7.  
  8. for /f "tokens=*" %%a in ('dir *.jpg /b') do ( call :main %%a )
  9.  
  10. goto :EOF
  11.  
  12. :main
  13. setlocal enableextensions enabledelayedexpansion
  14. for /f "tokens=1,2 delims= " %%i in ('%magic% identify -format "%%w %%h" %~f1') do (
  15.     set w=%%~i
  16.     set h=%%~j
  17. )
  18. if !w! GTR !h! (
  19.     set hc=10
  20.     set /a wc=!w!/2
  21. ) else (
  22.     set /a hc=!h!/2
  23.     set wc=10
  24. )
  25. if !w! GTR !h! (set min=!h!) else (set min=!w!)
  26. set /a h2=!h!/2
  27. set /a w2=!w!/2
  28. %convert% -size !w!x!h! xc:PeachPuff -fill LightBlue -draw "circle !w2!,!h2! !wc!,!hc!" -transparent LightBlue mask.png
  29. %convert% %~f1 mask.png -composite temp.png
  30. %convert% temp.png -transparent PeachPuff temp.png
  31. %convert% temp.png -gravity Center -crop !min!x!min!+0 %~dpn1.png
  32. del mask.png temp.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement