ECHO OFF
COLOR A
SET resolution=128x64
SET file=jpg
SET resize=black_border
SET convert=Monochrome
SET vres=64
SET vsize=-resize %resolution%^^ -gravity center -background #000000 -extent %resolution%
SET vmode=-monochrome

:MENU
CLS
ECHO.
ECHO ..........................................
ECHO  image.%file% convert to boot%vres%.mono
ECHO ..........................................
ECHO.
ECHO 1 - %resolution%
ECHO 2 - images.%file%
ECHO 3 - Resize: %resize%
ECHO 4 - B^&W algorithm: %convert%
ECHO 5 - Convert All in One
ECHO ------------------------ 
ECHO 6 - Convert B^&W
ECHO 7 - Resize
ECHO 8 - Create .mono file
ECHO ------------------------ 
ECHO 9 - EXIT
ECHO.
SET /P M=Please select and press ENTER: 
IF %M%==1 GOTO RES
IF %M%==2 GOTO EXT
IF %M%==3 GOTO SIZE
IF %M%==4 GOTO CONV
IF %M%==5 GOTO CCONV
IF %M%==6 GOTO CBW
IF %M%==7 GOTO CRES
IF %M%==8 GOTO CMONO
IF %M%==9 GOTO EOF

:RES
IF %resolution%==128x64 GOTO 32
IF %resolution%==128x32 GOTO 64
:32
SET resolution=128x32
SET vres=32
GOTO SIZE
:64
SET resolution=128x64
SET vres=64
GOTO SIZE

:EXT
IF %file%==jpg GOTO E1
IF %file%==png GOTO E2
IF %file%==bmp GOTO E3
:E1
SET file=png
GOTO MENU
:E2
SET file=bmp
GOTO MENU
:E3
SET file=jpg
GOTO MENU

:SIZE
IF %resize%==black_border GOTO S1
IF %resize%==white_border GOTO S2
IF %resize%==distorted GOTO S3
IF %resize%==cut_out GOTO S4
:S1
SET resize=white_border
SET vsize=-resize %resolution%^^ -gravity center -extent %resolution%
GOTO MENU
:S2
SET resize=distorted
SET vsize=-resize %resolution%! -gravity center
GOTO MENU
:S3
SET resize=cut_out
SET vsize=-gravity center -crop %resolution%+0+0 +repage
GOTO MENU
:S4
SET resize=black_border
SET vsize=-resize %resolution%^^ -gravity center -background #000000 -extent %resolution%
GOTO MENU

:CONV
IF %convert%==Monochrome GOTO C1
IF %convert%==Kapur GOTO C2
IF %convert%==Triangle GOTO C3
IF %convert%==OTSU GOTO C4
:C1
SET convert=Kapur
SET vmode=-auto-threshold Kapur
GOTO MENU
:C2
SET convert=Triangle
SET vmode=-auto-threshold Triangle
GOTO MENU
:C3
SET convert=OTSU
SET vmode=-auto-threshold OTSU
GOTO MENU
:C4
SET convert=Monochrome
SET vmode=-monochrome
GOTO MENU


:CCONV
echo convert image.%file% %vmode% mono%vres%.bmp
convert image.%file% %vmode% mono%vres%.bmp
echo Monochrome OK
echo convert mono%vres%.bmp %vsize% boot%vres%.bmp
convert mono%vres%.bmp %vsize% boot%vres%.bmp
echo Resize OK
echo convert boot%vres%.bmp MONO:boot%vres%.mono
convert boot%vres%.bmp MONO:boot%vres%.mono
echo Convert OK
PAUSE
GOTO MENU

:CBW
echo convert image.%file% %vmode% mono%vres%.bmp
convert image.%file% %vmode% mono%vres%.bmp
echo Monochrome OK
PAUSE
GOTO MENU

:CRES
echo convert mono%vres%.bmp %vsize% boot%vres%.bmp
convert mono%vres%.bmp %vsize% boot%vres%.bmp
echo Resize OK
PAUSE
GOTO MENU

:CMONO
echo convert boot%vres%.bmp MONO:boot%vres%.mono
convert boot%vres%.bmp MONO:boot%vres%.mono
echo Convert OK
PAUSE
GOTO MENU



