Skip to content

Instantly share code, notes, and snippets.

@castella-cake
Created December 12, 2022 14:17
Show Gist options
  • Save castella-cake/459fde1f006030227aff1ca173874ad2 to your computer and use it in GitHub Desktop.
Save castella-cake/459fde1f006030227aff1ca173874ad2 to your computer and use it in GitHub Desktop.
RealESRGANをより素早く実行するバッチファイル(依頼品)
@echo off
setlocal enabledelayedexpansion
set version=v1.3.2
set x=%*
set outputsuccess=0
set outputfailed=0
rem edit area start
set fullauto=0
set modeltype=2
set scale=4
rem edit area end
echo QuickREGAN %version%
echo Created by CYakigasi
if exist realesrgan-ncnn-vulkan.exe (
echo realesrgan-ncnn-vulkan.exe exists.
) else (
echo realesrgan-ncnn-vulkan.exe does not exist! Aborting...
pause
exit
)
if "%~1"=="" (
echo File not dropped! Aborting...
pause
exit
)
cls
echo QuickREGAN %version%
echo Created by CYakigasi
echo;
if %fullauto%==0 (
echo Mode: Manual
echo Model: Not set
echo Scale: Not set
echo Dropped files:
for %%i in (!x!) do (
echo %%~ni%%~xi
)
echo;
echo Select the model to use:
echo 0 - realesrgan-x4plus
echo 1 - realesrnet-x4plus
echo 2 - realesrgan-x4plus-anime
echo 3 - realesr-animevideov3
echo;
set /p modeltype=Select:
cls
echo QuickREGAN %version%
echo Created by CYakigasi
echo;
echo Mode: Manual
if !modeltype!==0 (
echo Model: realesrgan-x4plus
) else if !modeltype!==1 (
echo Model: realesrnet-x4plus
) else if !modeltype!==2 (
echo Model: realesrgan-x4plus-anime
) else if !modeltype!==3 (
echo Model: realesr-animevideov3
) else (
echo Model: default
set modeltype=2
)
echo Scale: Not set
echo Dropped file:
for %%i in (!x!) do (
echo %%~ni%%~xi
)
echo;
if !modeltype!==0 (
set /p scale=Image scale:
)
echo Set to !scale!x
)
if !modeltype!==0 (
set modelname="realesrgan-x4plus"
) else if !modeltype!==1 (
set modelname="realesrnet-x4plus"
) else if !modeltype!==2 (
set modelname="realesrgan-x4plus-anime"
) else if !modeltype!==3 (
set modelname="realesr-animevideov3"
) else (
echo Unknown model selected! Aborting...
pause
exit
)
cls
for %%i in (!x!) do (
echo %%i
echo QuickREGAN %version%
echo Created by CYakigasi
echo;
echo Mode: Manual
echo Image: %%~ni%%~xi
echo Model: %modelname%
echo Scale: !scale!
echo;
echo Starting...
echo Command: realesrgan-ncnn-vulkan.exe -i %%~i -o %%~dpni-!scale!x-output.png -n %modelname% -s !scale!
realesrgan-ncnn-vulkan.exe -i %%i -o "%%~dpni-!scale!x-output.png" -n %modelname% -s !scale!
if exist %%~dpni-!scale!x-output.png (
echo Successful. The image was output to %%~dpni-!scale!x-output.png
set /a outputsuccess+=1
) else (
echo Image output failed: %%~dpni-!scale!x-output.png
set /a outputfailed+=1
)
echo;
)
echo Processing finished.
echo Success: %outputsuccess%, Failed: %outputfailed%
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment