同じディレクトリのpng画像を長辺900pxにリサイズするbatファイル(http://qiita.com/smison/items/d32eb72be807e099dfa0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setlocal enabledelayedexpansion | |
for %%f in (*.png) do ( | |
REM 画像の縦幅を取得 | |
for /f "usebackq tokens=*" %%i in (`identify -format '%%h' %%f`) do @set HEIGHT=%%i | |
REM 画像の横幅を取得 | |
for /f "usebackq tokens=*" %%i in (`identify -format '%%w' %%f`) do @set WIDTH=%%i | |
if !HEIGHT! GEQ !WIDTH! ( | |
REM 縦幅 >= 横幅 | |
convert -resize x900 %%f %%~nf_resized.png | |
) else ( | |
REM 縦幅 < 横幅 | |
convert -resize 900x %%f %%~nf_resized.png | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment