Last-modified: 2016-01-10 (日) 05:18:47
スクリプト/waifu.bat

概要

waifuで指定フォルダ直下の画像を劣化せずに拡大するバッチです。

コード

Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-
-
|
|
|
!
!
 
 
:: 
:: 指定フォルダ直下の画像を劣化せずに拡大
:: 
 
:: %1 対象パス(省略でカレントパス)
:: %2 拡大率(省略で2)
 
@echo off
 
:: =============================================================================
 
:: waifu2x-caffeのパス
@set EXE="C:\Program Files2\waifu2x-caffe\waifu2x-caffe-cui.exe"
 
:: =============================================================================
setlocal ENABLEDELAYEDEXPANSION
set targetPath=%~dp0
if not "%1"=="" (set targetPath=%1)
set ratio=2
if not "%2"=="" (set ratio=%2)
 
pushd %targetPath%
echo %targetPath%
 
set maxCount=0
for /R %%i in ( * ) do ( if not "%%i"==%0 ( set /A maxCount=maxCount+1 ) )
 
set count=0
for /R %%i in ( * ) do (
    if not "%%i"==%0 (
        set /A count=count+1
        echo [!time!]!count! / %maxCount%, %%~nxi
        %EXE% -i "%%i" -o "%%i" -p gpu -m noise_scale --scale_ratio %ratio% --noise_level 1
    )
)
 
pause

検証時の環境