Skip to content

Instantly share code, notes, and snippets.

@smison smison/resize.bat
Last active Aug 29, 2015

What would you like to do?
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
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
You can’t perform that action at this time.