Skip to content

Instantly share code, notes, and snippets.

@xymopen
Last active February 17, 2017 20:19
Show Gist options
  • Save xymopen/4a86c18ff3f441e3e9b1fe07e7141338 to your computer and use it in GitHub Desktop.
Save xymopen/4a86c18ff3f441e3e9b1fe07e7141338 to your computer and use it in GitHub Desktop.
a Windows CMD batch to process images with https://github.com/tanakamura/waifu2x-converter-cpp.
@echo off
pushd "%~dp0"
setlocal enabledelayedexpansion
if /i %PROCESSOR_ARCHITECTURE% == x86 set bin=waifu2x-converter_x86.exe
if /i %PROCESSOR_ARCHITECTURE% == amd64 set bin=waifu2x-converter_x64.exe
:LOOP
set __test=%1
if not defined __test goto END
set i="%~dpnx1"
set o="%~dpn1%_waifu2x.png"
if not exist %i% goto CONTINUE
echo Processing %~nx1...
if /i %~x1 == .jpg set is_jpeg=1
if /i %~x1 == .jpeg set is_jpeg=1
if defined is_jpeg (
%bin% -m noise_scale --noise_level 1 --scale_ratio 2 -i %i% -o %o% > NUL
) else (
%bin% -m scale --scale_ratio 2 -i %i% -o %o% > NUL
)
:CONTINUE
shift
goto LOOP
:END
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment