Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- rem https://www.imagemagick.org
- setlocal enableextensions enabledelayedexpansion
- set convert=c:\Programs\ImageMagick-7.0.6-0\convert.exe
- set magic=c:\Programs\ImageMagick-7.0.6-0\magick.exe
- for /f "tokens=*" %%a in ('dir *.jpg /b') do ( call :main %%a )
- goto :EOF
- :main
- setlocal enableextensions enabledelayedexpansion
- for /f "tokens=1,2 delims= " %%i in ('%magic% identify -format "%%w %%h" %~f1') do (
- set w=%%~i
- set h=%%~j
- )
- if !w! GTR !h! (
- set hc=10
- set /a wc=!w!/2
- ) else (
- set /a hc=!h!/2
- set wc=10
- )
- if !w! GTR !h! (set min=!h!) else (set min=!w!)
- set /a h2=!h!/2
- set /a w2=!w!/2
- %convert% -size !w!x!h! xc:PeachPuff -fill LightBlue -draw "circle !w2!,!h2! !wc!,!hc!" -transparent LightBlue mask.png
- %convert% %~f1 mask.png -composite temp.png
- %convert% temp.png -transparent PeachPuff temp.png
- %convert% temp.png -gravity Center -crop !min!x!min!+0 %~dpn1.png
- del mask.png temp.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement